# Must\_not does not work in the nested array

**URL:** <https://discuss.elastic.co/t/must-not-does-not-work-in-the-nested-array/374191>\
**Category:** Elasticsearch\
**Created:** [February 6, 2025, 6:13pm UTC](https://discuss.elastic.co/t/must-not-does-not-work-in-the-nested-array/374191 "2025-02-06T18:13:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [February 6, 2025, 9:43pm UTC](https://discuss.elastic.co/t/must-not-does-not-work-in-the-nested-array/374191/2 "2025-02-06T21:43:50Z")

</div>

Please share an example of the (to your understanding, incorrectly) matching document, the whole document, and the mapping please.

There's specific guidance in the docs for must\_not clauses and nested queries. I've no idea if it's helpful/applicable here.

> **[Nested query | Elasticsearch Guide \[8.17\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html)**

You posted a pretty similar Q recently !?

> [@The doucment is returned even if it does not meet the criteria](https://discuss.elastic.co/t/the-doucment-is-returned-even-if-it-does-not-meet-the-criteria/374145):
>
> I use the following DSL query "size": 25, "query": { "bool": { "must": [ { "term": { "hcAccountabilityOfficeCode.keyword": { "value": "550" } } }, { "nested": { "query": { "term": { "hearingActionDetails.haaActionTypeCode.keyword": { "value": "SU" } } }, "path": "hearingActionDetails", "ignore\_unmapped": false, "score\_mode": "none", "boost": 1.0 } }, { "nested": { "query": …

which is still open, waiting on your input.

---

_[View the full topic](https://discuss.elastic.co/t/must-not-does-not-work-in-the-nested-array/374191)._
