# Could not add subquery to bool must query

**URL:** <https://discuss.elastic.co/t/could-not-add-subquery-to-bool-must-query/81015>\
**Category:** Elasticsearch\
**Created:** [April 3, 2017, 2:42pm UTC](https://discuss.elastic.co/t/could-not-add-subquery-to-bool-must-query/81015 "2017-04-03T14:42:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itrnka](https://avatars.discourse-cdn.com/v4/letter/i/f4b2a3/32.png) [@itrnka](https://discuss.elastic.co/u/itrnka)\
**Post date:** [April 3, 2017, 2:42pm UTC](https://discuss.elastic.co/t/could-not-add-subquery-to-bool-must-query/81015/1 "2017-04-03T14:42:47Z")

</div>

I have some problem with Elasticsearch version: 5.1.1

in older versions was supported query in query in unlimited tree level, eg.:

```
query: {
    bool: {
        'must' => [
             'query': {
                   'should': ...
             }
        ]
    }
}

```

it can not be simulated yet...

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2017, 3:10pm UTC](https://discuss.elastic.co/t/could-not-add-subquery-to-bool-must-query/81015/2 "2017-04-03T15:10:51Z")

</div>

You can still do that:

```auto
query: {
    bool: {
        'must' => [
             bool: {
                   'should': ...
             }
        ]
    }
}

```

---

<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:** [May 1, 2017, 3:10pm UTC](https://discuss.elastic.co/t/could-not-add-subquery-to-bool-must-query/81015/3 "2017-05-01T15:10:57Z")

</div>

Closed on May 1, 2017, 3:10pm UTC

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