【问题标题】:Elasticsearch term suggester does not return results on exact matchElasticsearch 术语建议器不返回完全匹配的结果
【发布时间】:2015-11-21 18:51:55
【问题描述】:

当我请求建议者时

{
    "my-title-suggestions-1": {
       "text": "tücher                ",
       "term": {
            "field": "name",
       }
    },
    "my-title-suggestions-2": {
       "text": "tüchers                ",
       "term": {
           "field": "name"
       }
    }
}

返回

{
    "_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
            }
        ]
    }
    ]
}

我想知道为什么它不返回与第一个建议者的完全匹配? 第二个建议者显然有这个结果。

我可以添加其他选项来解决此问题吗?

编辑: 最小的映射就是这样...

{
"name" : {
        "analyzer" : "standard",
        "type" : "string"
    }
}

【问题讨论】:

  • 你也可以发布索引映射吗?
  • @madsen 映射的具体结构应该是无关紧要的......它有一个名为 name 的字符串字段......但是我添加了映射
  • 字段是否经过分析、过滤和/或标记化不一定无关紧要。
  • 我目前有同样的问题。这是相关的issuepull request。目前已打开,但似乎已准备好合并。

标签: elasticsearch search-suggestion


【解决方案1】:

补充@ChintanShah25 所说的内容:根据https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-suggesters-term.html(请参阅suggest_mode),术语建议者将默认:

仅对不在索引中的建议文本术语提供建议。

【讨论】:

  • 即使使用always 似乎也不会导致精确匹配返回,至少在 es1.5 中不会
【解决方案2】:

我不认为你能做到这一点,我不确定你为什么要在suggestions 中完全匹配,毕竟它们是“建议”。

它们通常用于检查拼写错误。它将为您提供与您输入的单词相似且属于edit distance of 2 的候选建议。

【讨论】:

  • 是的,我目前正在用一个额外的字符来毒化请求,现在这个“对我有用”......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-25
  • 2015-11-19
  • 2020-04-27
  • 1970-01-01
相关资源
最近更新 更多