# Nested bool querie

**URL:** <https://discuss.elastic.co/t/nested-bool-querie/354015>\
**Category:** Elasticsearch\
**Created:** [February 23, 2024, 6:36pm UTC](https://discuss.elastic.co/t/nested-bool-querie/354015 "2024-02-23T18:36:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eirik](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@eirik](https://discuss.elastic.co/u/eirik)\
**Post date:** [February 23, 2024, 6:36pm UTC](https://discuss.elastic.co/t/nested-bool-querie/354015/1 "2024-02-23T18:36:44Z")

</div>

Hi,  
I'm pretty new to queries in elastic and need some help to understand how the post\_filter below is executed for both when a document has the \_id field and when it doesn't have it 🙂

```auto
"post_filter": {
        "bool": {
            "must": [
                {
                    "bool": {
                        "should": [
                            {
                                "bool": {
                                    "must_not": [
                                        {
                                            "exists": {
                                                "field": "_id",
                                                "boost": 1.0
                                            }
                                        }
                                    ],
                                    "boost": 1.0
                                }
                            }
                        ],
                        "boost": 1.0
                    }
                }
            ],
            "boost": 1.0
        }
    }

```

---

<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:** [March 22, 2024, 6:37pm UTC](https://discuss.elastic.co/t/nested-bool-querie/354015/2 "2024-03-22T18:37:27Z")

</div>

Closed on March 22, 2024, 6:37pm UTC

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