我很困惑。我有以下文件索引:多場分析儀不按預期工作
POST test/topic
{
"title": "antiemetics"
}
用下面的查詢:
{
"query": {
"query_string" : {
"fields" : ["title*"],
"default_operator": "AND",
"query" :"anti emetics",
"use_dis_max" : true
}
},
"highlight" : {
"fields" : {
"*" : {
"fragment_size" : 200,
"pre_tags" : ["<mark>"],
"post_tags" : ["</mark>"]
}
}
}
}
並進行如下設置和映射:
POST test{
"settings":{
"index":{
"number_of_shards":1,
"analysis":{
"analyzer":{
"merge":{
"type":"custom",
"tokenizer":"keyword",
"filter":[
"lowercase"
],
"char_filter":[
"hyphen",
"space",
"html_strip"
]
}
},
"char_filter":{
"hyphen":{
"type":"pattern_replace",
"pattern":"[-]",
"replacement":""
},
"space":{
"type":"pattern_replace",
"pattern":" ",
"replacement":""
}
}
}
}
},
"mappings":{
"topic":{
"properties":{
"title":{
"analyzer":"standard",
"search_analyzer":"standard",
"type":"string",
"fields":{
"specialised":{
"type":"string",
"index":"analyzed",
"analyzer":"standard",
"search_analyzer":"merge"
}
}
}
}
}
}
}
我知道我用了多場沒有按的沒有什麼意義,因爲我使用與標題相同的指數分析器,所以請忽略,但我更關心我對分析儀的理解。我期待合併分析器將以下查詢「anti emetics」更改爲「antiemetics」,我希望分析器應用的多字段設置將匹配令牌「止吐藥」,但我沒有得到任何結果,即使我測試過,分析器通過運行分析API從查詢中刪除空白區域。任何想法爲什麼?
您正在使用什麼版本的ES的? – ChintanShah25