Elasticsearch term suggester 没有 return 完全匹配的结果
Elasticsearch term suggester does not return results on exact match
当我用
请求建议者时
{
"my-title-suggestions-1": {
"text": "tücher ",
"term": {
"field": "name",
}
},
"my-title-suggestions-2": {
"text": "tüchers ",
"term": {
"field": "name"
}
}
}
它returns
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"my-title-suggestions-1": [
{
"text": "tücher",
"offset": 0,
"length": 6,
"options": []
}
],
"my-title-suggestions-2": [
{
"text": "tüchers",
"offset": 0,
"length": 7,
"options": [
{
"text": "tücher",
"score": 0.8333333,
"freq": 6
}
]
}
]
}
我想知道为什么它 return 与第一个建议者不完全匹配?
第二个建议者显然有那个结果。
我可以添加其他选项来解决此问题吗?
编辑:
最小映射就是这样...
{
"name" : {
"analyzer" : "standard",
"type" : "string"
}
}
我认为你做不到,我不确定你为什么要 suggestions
中的完全匹配,毕竟它们是 "suggestions"。
通常它们用于检查拼写错误。它将为您提供相似的候选建议,并且对于您输入的单词属于 edit distance
个,共 2 个。
添加@ChintanShah25 所说的内容:根据https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-suggesters-term.html(参见suggest_mode
),术语建议器默认情况下:
Only provide suggestions for suggest text terms that are not in the index.
当我用
请求建议者时{
"my-title-suggestions-1": {
"text": "tücher ",
"term": {
"field": "name",
}
},
"my-title-suggestions-2": {
"text": "tüchers ",
"term": {
"field": "name"
}
}
}
它returns
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"my-title-suggestions-1": [
{
"text": "tücher",
"offset": 0,
"length": 6,
"options": []
}
],
"my-title-suggestions-2": [
{
"text": "tüchers",
"offset": 0,
"length": 7,
"options": [
{
"text": "tücher",
"score": 0.8333333,
"freq": 6
}
]
}
]
}
我想知道为什么它 return 与第一个建议者不完全匹配? 第二个建议者显然有那个结果。
我可以添加其他选项来解决此问题吗?
编辑: 最小映射就是这样...
{
"name" : {
"analyzer" : "standard",
"type" : "string"
}
}
我认为你做不到,我不确定你为什么要 suggestions
中的完全匹配,毕竟它们是 "suggestions"。
通常它们用于检查拼写错误。它将为您提供相似的候选建议,并且对于您输入的单词属于 edit distance
个,共 2 个。
添加@ChintanShah25 所说的内容:根据https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-suggesters-term.html(参见suggest_mode
),术语建议器默认情况下:
Only provide suggestions for suggest text terms that are not in the index.