所以我有一個像這樣創建的elasticsearch指數:Elasticsearch與NGRAM索引沒有找到部分匹配
curl -XPUT 'http://localhost:9200/person' -d '{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}'
上詢問了一個名爲「伊恩」的人,我得到兩個結果
curl -XGET http://localhost:9200/person/_search -d '{
"query": {
"match": {
"_all": "ian"
}
}
}’
但在查詢只是字母ia
,我應該得到儘可能多的或更多的結果,而是我沒有得到任何:
curl -XGET http://localhost:9200/person/_search -d '{
"query": {
"match": {
"_all": "ia"
}
}
}’
關於我的edge_ngram
過濾器設置有什麼不對?我該如何解決這個問題?
編輯:爲了澄清,我想我的INSERT語句沿着這個
curl -XPOST "http://localhost:9200/person/RANDOM_STRING HERE/ANOTHER_RANDOM_STRING" -d "{
"field1" : "value",
"field2" : "value",
"field3" : "value"
}"
的線條看起來插入後,我想所有字段是edge_ngram分析,這樣我可以通過局部搜索任何這些字段的字符串,並返回此結果。
非常感謝!你是最好的 – johncorser