Elasticsearch——》es近义词(同义词)配置
程序员文章站
2023-12-21 23:10:28
...
系统:Linux
版本:elasticesearch7.6
根目录:/opt/app/elasticesearch7.6
1、近义词配置
进入目录:cd /opt/app/elasticesearch7.6/config
创建目录:mkdir analysis
进入目录:cd analysis
创建文件:touch tjdata-shop-synonym.txt
tjdata-shop-synonym.txt 内容如下:
搜房,房天下
成交均价,成交单价,房价,售价
保障房,经济适用房,配套商品房,动迁房,廉租房
出租,租赁
买卖,销售
2、分析器配置
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"ik_max_word": {
"tokenizer": "ik_max_word",
"filter": [
"my_synonym_filter"
]
}
},
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms_path": "analysis/synonym.txt"
}
}
}
}
}