我正在使用elasticsearch-7.0.0
。
我使用以下配置创建了索引:
{
"settings": {
"index": {
"analysis":{
"analyzer":{
"synonym":{
"tokenizer":"whitespace",
"filter":[
"synonym"
]
}
},
"filter":{
"synonym":{
"type":"synonym",
"synonyms_path":"synonyms.txt"
}
}
}
}
}
}
synonyms.txt
的内容:
ny, new york, big apple
ca, california, socal, norcal
我的文档为:
{
"name":"Berry's Burritos",
"description":"Best burritos in New York",
"address": {
"street":"230 W 4th St",
"city":"New York",
"state":"NY",
"zip":"10014"
},
"location":[40.7543385,-73.976313],
"tags":["mexican","tacos","burritos"],
"rating":"4.3"
}
使用此查询,其值与文档中的相同。 (不是同义词),它给出结果。
{
"query":{
"bool":{
"filter":{
"range":{
"rating":{
"gte":4.0
}
}
},
"must":{
"match":{
"address.state":"ny"
}
}
}
}
}
但是将address.state : "ny"
替换为address.state : "new york"
不会产生任何结果。
我在这里错过了什么吗?