Home > Net >  How can I understand with which query the documents returned as a result of the should query in elas
How can I understand with which query the documents returned as a result of the should query in elas

Time:05-17

I have a query like below. Here my minimum_should_match value is 1. Many documents with "text" value "car" or "year" value "2019" can return. Here, I want to find out by which query the documents returned as a result of this query are returned. How can I do this in elasticsearch?

GET my_index/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "text": {
              "value": "car"
            }
          }
        },
        {
          "term": {
            "rank": {
              "value": "2"
            }
          }
        },
        {
          "term": {
            "year": {
              "value": "2019"
            }
          }
        }
      ],
      "minimum_should_match": 1
    }
  }
}

CodePudding user response:

Named queries might work for you - https://www.elastic.co/guide/en/elasticsearch/reference/7.17//query-dsl-bool-query.html#named-queries

  • Related