【发布时间】:2017-09-15 22:50:08
【问题描述】:
请帮助我选择 ElasticSearch 建议类型。
我有包含大量公司的 ElasticSearch 索引,其名称如下:“JSC Some company”、“JSC Another company”等等。
CompletionSuggester 不起作用,因为用户更喜欢类型:“Some co...”,但仅当用户以“JSC Some co...”开头时,建议器才有效
有什么方法可以在用户输入时创建快速搜索?
我想添加我的映射示例并建议查询示例,以便更清楚地了解问题:
curl -XPUT 'localhost:9200/tass_suggest_test/_mapping/company?pretty' -H 'Content-Type: application/json' -d'
{
"company": {
"properties": {
"id": {
"type": "integer"
},
"inn": {
"type": "keyword"
},
"innSuggest" : {
"type" : "completion",
"analyzer": "whitespace"
}
}
}
}
'
curl -XGET 'localhost:9200/tass_suggest_test/_suggest?pretty' -H 'Content-Type: application/json' -d'
{
"company-suggest" : {
"prefix" : "78200",
"completion" : {
"field" : "innSuggest"
}
}
}
'
【问题讨论】:
标签: elasticsearch search-suggestion