模糊检索 fuzzy query

模糊查询使用基于 Levenshtein 编辑距离的相似性

将在6.0中正式移除,使用匹配查询替代模糊查询

curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "fuzzy": {
      "user.id": {
        "value": "ki"
      }
    }
  }
}
'
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "fuzzy": {
      "user.id": {
        "value": "ki",
        "fuzziness": "AUTO",
        "max_expansions": 50,
        "prefix_length": 0,
        "transpositions": true,
        "rewrite": "constant_score"
      }
    }
  }
}
'

https://www.elastic.co/guide/en/elasticsearch/reference/7.11/query-dsl-fuzzy-query.html

posted @ 2021-03-08 13:33  薄荷味日记  阅读(552)  评论(0编辑  收藏  举报