Bool query with empty body

I have inherited some code I am trying to understand. The query uses bool query with empty body within aggregations as shown below:

"aggs": {
    "aggregate_name": {
          "filter": {
            "bool": {}
          },
         "aggs": {
             "sub_aggr_name": {
                   "terms": {
                         "field": "somefield",
                         "size": 100
                    }
              }
         }
 }

Is it trying to set the parent aggregate bucket to empty? If so what document set will the sub-aggregate work on?

Hi,

My guess is that in a previous version there was something in the filter. I already saw some code like this the guy who write it was too lazy to rewrite cleanly and reformat the result.

Better to check in git or something like if you have track about the changes.

"aggs": {
    "aggregate_name": {
                   "terms": {
                         "field": "somefield",
                         "size": 100
                    }
              }
 }

This one will return the same result without the nested sub aggs key.

(the lazy guy was not me :innocent:)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.