# Bool query with empty body

**URL:** <https://discuss.elastic.co/t/bool-query-with-empty-body/187215>\
**Category:** Elasticsearch\
**Created:** [June 25, 2019, 2:19am UTC](https://discuss.elastic.co/t/bool-query-with-empty-body/187215 "2019-06-25T02:19:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shekharshan](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@shekharshan](https://discuss.elastic.co/u/shekharshan)\
**Post date:** [June 25, 2019, 2:19am UTC](https://discuss.elastic.co/t/bool-query-with-empty-body/187215/1 "2019-06-25T02:19:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [June 25, 2019, 3:47am UTC](https://discuss.elastic.co/t/bool-query-with-empty-body/187215/2 "2019-06-25T03:47:50Z")

</div>

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.

```auto
"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 😇)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 23, 2019, 3:47am UTC](https://discuss.elastic.co/t/bool-query-with-empty-body/187215/3 "2019-07-23T03:47:54Z")

</div>

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