【问题标题】:Fuzziness not behaving as expected in Elasticsearch模糊在 Elasticsearch 中的行为不符合预期
【发布时间】:2019-04-08 14:55:30
【问题描述】:

我正在尝试为我在 Elasticsearch 中做的项目测试几个测试用例。模糊查询给出的结果对于特定情况令人困惑:- 在搜索 Mall 关键字时,模糊度 2 应用于多重匹配查询,它也匹配 Mile

As per fuzziness documentation :-
=> 0 edits are allowed for string length is 0-2 .
=> 1 edit is allowed for  string length is 3-5.
=> 2 edits are allowed for string length greater than 5.

如果是这种情况,为什么 MILEMALL 匹配,因为按照逻辑只允许进行一次编辑,如果我们看到 MALL->MILE,我们需要2 次编辑。 Elasticsearch 的行为是否符合预期,或者我在这里遗漏了什么。 我正在对字段使用简单的空格分析器并使用

进行查询
         {  "query": {
            "multi_match": {
                "query": "mall",
                "fields": [
                          "name"
                 ],
                 "fuzziness": 2
          } }}

【问题讨论】:

    标签: elasticsearch elastic-stack fuzzy-search damerau-levenshtein


    【解决方案1】:

    您突出显示的文档仅适用于您指定 "fuzziness": "AUTO" 时,否则如果您指定一个普通数字(0、1 或 2),则考虑该数字(在您的情况下为 2)

    【讨论】:

    • 感谢@Val 现在明白了。
    猜你喜欢
    • 1970-01-01
    • 2018-10-22
    • 1970-01-01
    • 2021-05-09
    • 1970-01-01
    • 2017-01-27
    • 2022-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多