這個查詢,其搜索單詞little
如何啓用全域前綴匹配在elasticsearch查詢
{
"query": {
"match": {
"title": {
"max_expansions": 20,
"prefix_length": 3,
"query": "little",
"slop": 1,
"type": "phrase_prefix"
}
}
}
}
返回匹配以下
"title": "Little Gem"
"title": "Little Szechuan"
但是,如果我改變這個詞來little s
,我期待"Little Szechuan"
匹配。
下面的查詢將獲得零匹配
{
"query": {
"match": {
"title": {
"max_expansions": 20,
"prefix_length": 3,
"query": "little",
"slop": 1,
"type": "phrase_prefix"
}
}
}
}
我也試圖調整prefix_length
1,目前仍然沒有比賽
這是用於title
"title": {
"type": "string",
"analyzer": "my_analyzer"
},
映射
這裏是分析儀用於title
"analysis": {
"analyzer": {
"my_analyzer": {
"filter": [
"standard",
"lowercase",
"my_snow"
],
"tokenizer": "standard"
}
},
"filter": {
"my_snow": {
"type": "snowball",
"language": "English"
}
}
},
什麼是「標題」的映射? – kcdragon
@kcdragon請參閱更新 – samol