首页 > 解决方案 > Elasticsearch fuzziness and multiple terms comparison

问题描述

Basically im currently creating fuzzy search for elasticsearch and i have two kinds of search to compare

One is auto fuzzy search

{
    "query": {
       "match": {
         "user": {
           "query": "test",
           "fuzziness": "AUTO"
         }
       }
    }
}

Others is a terms query matching with multiple typos

{
    "query" : {
        "terms" : {
            "user" : ["test", "testt", "tesr", "tst", ...]
        }
    }
}

assuming thre might be around 20s or more of the terms, what i want to know is, which one is more likely a better practice and better by performance, and how scalable is terms matching with a lot of keyword.

标签: elasticsearch

解决方案


匹配查询:

  1. 分析输入字符串并从中构造更多基本查询。
  2. 当您需要全文搜索功能时使用它。
  3. 您可以将其用于部分匹配、令牌搜索、模糊逻辑

术语查询:

  1. 匹配确切的术语。
  2. 如果搜索的文本不需要任何分析,即必须按原样匹配文本,则应使用此选项。
  3. 它比匹配更快

推荐阅读