【问题标题】:How to aproximate matches in elasticsearch?如何在弹性搜索中近似匹配?
【发布时间】:2020-03-12 05:04:10
【问题描述】:

我的 API 现在有这个查询:

{
"query": {
           "multi_match": {
               "query": event, //this is send by the API
               "fields": ["company", "location"]
            }
         }
}

如果我写一个像“chi”这样的部分搜索,除非我写一个像“china”这样的完整词,否则我会得到 0 次点击。我根据弹性搜索尝试了通配符,但是,我想要实现的是,如果我写“Chi”,我应该得到例如“china”或“Chile”,因为它们都匹配。对于任何其他部分匹配,我想要相同的。我认为通配符可以解决问题,但事实并非如此。

如何在 Elasticsearch 中匹配部分查询?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    尝试查询字符串

    "query": {
        "query_string": {
            "query": "*chi*",
            "fields": ["company", "location"]
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-12
      • 1970-01-01
      • 2017-08-30
      相关资源
      最近更新 更多