# The doucment is returned even if it does not meet the criteria

**URL:** <https://discuss.elastic.co/t/the-doucment-is-returned-even-if-it-does-not-meet-the-criteria/374145>\
**Category:** Elasticsearch\
**Created:** [February 5, 2025, 7:22pm UTC](https://discuss.elastic.co/t/the-doucment-is-returned-even-if-it-does-not-meet-the-criteria/374145 "2025-02-05T19:22:04Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:47pm UTC](https://discuss.elastic.co/t/the-doucment-is-returned-even-if-it-does-not-meet-the-criteria/374145/5 "2025-02-06T21:47:45Z")

</div>

See similar thread, where the actual query in that thread is generated by a call to /sql/translate - @vinitp I would be curious if same is true here?

Opening multiple threads on effectively the same topic is, er, a little irritating.

> [@Must\_not does not work in the nested array](https://discuss.elastic.co/t/must-not-does-not-work-in-the-nested-array/374191):
>
> I have an application that generates Elasticsearch SQL dynamically based on the client's search criteria. The application then use the "/sql/translate" API to translate to the DSL query which it executes. The sample of the SQL looks like this: "select \* from hearing\_alias where hcAccountabilityOfficeCode = '550' AND hearingActionDetails.haaActionTypeCode = 'SU' AND hearingActionDetails.haaActionCatCode = 'A' AND hcStatusCode \<\> 'STS54' AND hearingActionDetails.haaPartyRespRcvdOn is null AND…

---

_[View the full topic](https://discuss.elastic.co/t/the-doucment-is-returned-even-if-it-does-not-meet-the-criteria/374145)._
