Skip to content Skip to sidebar Skip to footer

How Do I Combine These Two Queries In Elastic Search Python?

I have two queries I would like to combine First one returns results that have the 'analysis.data_counts' value greater than 0. { 'query': { 'range' : { 'analy

Solution 1:

You can do it like this:

{
  "query": {
    "bool": {
      "must": [
        {
          "exists": {
            "field": "data_types"
          }
        },
        {
          "range" : {
            "analysis.data_counts" : {
               "gte" : 1,
            }
          }
        }
      ],
      "should": {
        "term": {
          "reviewed": False
        }
      }
    }
  }
}

Post a Comment for "How Do I Combine These Two Queries In Elastic Search Python?"