# Understanding Bool and Nested Query

**URL:** <https://discuss.elastic.co/t/understanding-bool-and-nested-query/313102>\
**Category:** Elasticsearch\
**Created:** [August 28, 2022, 5:20pm UTC](https://discuss.elastic.co/t/understanding-bool-and-nested-query/313102 "2022-08-28T17:20:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya-Kumar-Sinha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditya-kumar-sinha/32/110166_2.png) [@Aditya-Kumar-Sinha](https://discuss.elastic.co/u/Aditya-Kumar-Sinha)\
**Post date:** [August 28, 2022, 5:20pm UTC](https://discuss.elastic.co/t/understanding-bool-and-nested-query/313102/1 "2022-08-28T17:20:44Z")

</div>

I want to understand both the queries how they are different

```auto
"query": {
    "nested": {
      "path": "addresses",
      "query": {
        "bool": {
          "must_not": [
            {
              "exists": {
                "field": "addresses"
              }
            }
          ]
        }
      }
    }
  }

```

```auto
"query": {
    "bool": {
      "must_not": [
        {
          "nested": {
            "path": "addresses",
            "query": {
              "exists": {
                "field": "addresses"
              }
            }
          }
        }
      ]
    }
  }

```

---

<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:** [September 25, 2022, 5:21pm UTC](https://discuss.elastic.co/t/understanding-bool-and-nested-query/313102/2 "2022-09-25T17:21:31Z")

</div>

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