我是elasticsearch的新手,並試圖實現搜索。下面是我的索引和設置curl -XPUT localhost:9200/rets_data/ -d '{ "settings":{ "index":{ "analysis":{ "analyzer":{ "analyzer_startswith":{ "tokenizer":"keyword", "filter":"lowercase" }, "analyzer_whitespacewith":{ "tokenizer":"whitespace", "filter":"lowercase" } } } } }, "mappings":{ "city":{ "properties":{ "CityName":{ "analyzer":"analyzer_startswith", "type":"string" } } }, "rets_aux_subdivision":{ "properties":{ "nn":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "field_LIST_77":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "SubDivisionName":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "SubDivisionAlias":{ "analyzer":"analyzer_whitespacewith", "type":"string" } } }, "rental_aux_subdivision":{ "properties":{ "nn":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "field_LIST_77":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "SubDivisionName":{ "analyzer":"analyzer_whitespacewith", "type":"string" }, "SubDivisionAlias":{ "analyzer":"analyzer_whitespacewith", "type":"string" } } } } }'
Elasticsearch搜索模式與開始字符串
下面是搜索字符串
curl -XGET localhost:9200/rets_data/rets_aux_subdivision/_search?pretty -d '{"query":{"match_phrase_prefix":{"nn":{"query":"boca w","max_expansions":50}}},"sort":{"total":{"order":"desc"}},"size":100}'
當我正在尋找像「博卡R」的所有文字,「博卡W」它沒有給我造成的。
我的預期結果如下。
「Boca w」應該給我開始「Boca w」的結果。即「Boca west」,「Boca Woods」,「Boca Winds」
請幫助我。
感謝
您可以發佈一個示例文檔。 –