fuzziness in bool query with multimatch elasticsearch

前端 未结 2 815
我寻月下人不归
我寻月下人不归 2021-01-17 03:15

i am using elasticsearch version 6.3.0. I want to use fuzziness along with multimatch. but there is no option for that. Can anybody provide me a solution ? Thanks in advance

2条回答
  •  清酒与你
    2021-01-17 03:27

    What makes you think there is no option for fuzziness on a multi-match query?

    For example, with the data below:

    http://localhost:9200/question_1/doc/_bulk
    {"index":{}}
    {"name" : "John Lazy", "text": "lazzi"}
    {"index":{}}
    {"name" : "John Lassi", "text": "lasso"}
    {"index":{}}
    {"name" : "Joan Labbe", "text": "lazzy"}
    

    And this query:

    http://localhost:9200/question_1/_search
    {
      "query": {
        "multi_match" : {
          "query" : "lazi",
          "fields" : [ "name", "text" ],
          "fuzziness": 1
        }
      }
    }
    

    Then I get one result, but if I change the fuzziness parameter to 2 I'll get three results.

提交回复
热议问题