elasticsearch,Php,Amazon Web Services,elasticsearch" /> elasticsearch,Php,Amazon Web Services,elasticsearch" />

Php 最小\u编号\u应\u匹配Elasticsearch新版本中不工作

Php 最小\u编号\u应\u匹配Elasticsearch新版本中不工作,php,amazon-web-services,elasticsearch,Php,Amazon Web Services,elasticsearch,大家好,我正在使用弹性搜索检索数据。我得到的错误如下:- { "error": { "root_cause": [ { "type": "parsing_exception", "reason": "[bool] query does not support [minimum_number_should_match

大家好,我正在使用弹性搜索检索数据。我得到的错误如下:-

{
 "error": {
    "root_cause": [
        {
            "type": "parsing_exception",
            "reason": "[bool] query does not support [minimum_number_should_match]",
            "line": 1,
            "col": 396
        }
    ],
    "type": "parsing_exception",
    "reason": "[bool] query does not support [minimum_number_should_match]",
    "line": 1,
    "col": 396
},
"status": 400
}
为此,我编写了以下代码:

{
"_source": [
    "ch",
    "text",
    "title",
    "d_name"
],
"track_scores": true,
"sort": [
    "_score"
],
"size": 50,
"from": 0,
"query": {
    "bool": {
        "should": [
            {
                "match_phrase": {
                    "text": {
                        "query": "xxx",
                        "slop": 5
                    }
                }
            },
            {
                "match_phrase": {
                    "title": {
                        "query": "xxx",
                        "slop": 0,
                        "boost": 9
                    }
                }
            },
            {
                "match_phrase": {
                    "ch": {
                        "query": "xxxx",
                        "slop": 0,
                        "boost": 15
                    }
                }
            }
        ],
        "minimum_number_should_match": 1,
        "filter": {
            "bool": {
                "should": [
                    {
                        "term": {
                            "d_name": "The  Central"
                        }
                    }
                ]
            }
        }
    }
 }
}

它可以在旧版本上正常工作,但不能在新版本上工作。如果我删除了“minimum\u number\u should\u match”,那么它会给出不正确的结果,如果我使用了“minimum\u should\u match”,那么它会给出那些没有找到查询值的记录。

您需要使用参数,而不是
minimum\u number\u should\u match

更新1:

根据下面的注释,搜索查询将被删除

{
  "query": {
    "bool": {
      "must": {
        "multi_match": {
          "query": "supply",
          "fields": [
            "chapters",
            "title",
            "text"
          ]
        }
      },
      "filter": {
        "term": {
          "id": "1215"
        }
      }
    }
  }
}

它应该是
最小值\u应该匹配
它没有给我准确的记录。它也给出了那些“xxx”没有的记录found@RajasthanAyurvedUniversity请您用一些示例索引数据解释您的用例,并分享您的预期搜索结果以及{“_source”:[“chapters”,“title”,“comment”,“text”,“doc”,“name”],“track_scores”:true,“sort”:[“_scores”],“size”:50,“from”:0,“query”:{“bool”:{“should”:[{“匹配短语”:{“文本”:{“查询”:{“供应”,“slop”:3}}},{“匹配短语”:{“标题”:{“查询”:“供应”,“slop”:0,“boost”:3}}}},{“匹配短语”:{“章节”:{“查询”:“供应”,“slop”:0,“boost”:5}}}}},{“最小匹配”:1,“过滤器”:{“bool”:{“应该”:{“应该”{“术语”:{“id”:“12}}},},},},},{“字段”{索引是->标题、注释、文本、文档、名称。大约有1000条记录。我希望在每个IDB中至少有一条“供应”匹配('title'、'text'、'chapter'),但它也给了我id=“12”记录,其中未找到“供应”