【问题标题】:executing a multi-“match-phrase” query in Elastic Search with `or` opeator在 Elasticsearch 中使用“或”运算符执行多“匹配短语”查询
【发布时间】:2023-04-10 23:44:01
【问题描述】:
{
  "query": {
    "bool": {
      "or": [
         {"match_phrase": {"text":  "first phrase"}},
         {"match_phrase": {"text":  "second phrase"}}
      ]
    }
 }
}

我想匹配包含与输入的短语之一完全相同的所有文档。

【问题讨论】:

    标签: ruby-on-rails elasticsearch match-phrase


    【解决方案1】:
    {
        "query": {
            "constant_score" : {
                "filter" : {
                     "bool" : {
                        "or" : [
                            { "term" : { "text" : "first phrase" } }, 
                            { "term" : { "text" : "second phrase" } } 
                        ]
                    }
                }
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-06-17
      • 1970-01-01
      • 2018-06-05
      • 1970-01-01
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      相关资源
      最近更新 更多