我对Elasticsearch还是很陌生,目前正试图在分析仪方面着手研究 completion suggester
completion suggester
我有一个这样的地方列表:
通过将完成提示的映射设置为以下内容:
'place_suggest': { 'type': 'completion', 'payloads': true, 'index_analyzer' : 'stop', 'search_analyzer' : 'stop', 'preserve_position_increments' : false }
现在,当建议者文本输入只是字母时,我就可以返回上述所有三个建议 L
L
但是,我希望The London Eye在用户键入单词时返回,并且在用户键入时eye也The London Dungeon返回Dungeon(当然,这些术语的任何前缀)
The London Eye
eye
The London Dungeon
Dungeon
在今天的大部分时间里,我一直在使用不同的分析仪和设置,但没有成功。
我需要使用哪种分析仪来实现上述目标?
您可以使用“ 完成建议器”实现所需的功能。使用多个输入字段和一个统一的输出。如果输入字段之一匹配,则将返回输出字段。
curl -X PUT localhost:9200/places/place/1 -d ' { "title" : "The London Eye", "place_suggest" : { "input" : [ "The London Eye", "Eye" ], "output":"The London Eye" } }' curl -X PUT localhost:9200/places/place/2 -d ' { "title" : "The London Dungeon", "place_suggest" : { "input" : [ "The London Dungeon", "Dungeon" ], "output":"The London Dungeon" } }'