# Elasticsearch giving incorrect result when using "must\_not" operator alongwith "must" operator

**URL:** https://discuss.elastic.co/t/elasticsearch-giving-incorrect-result-when-using-must-not-operator-alongwith-must-operator/22308
**Category:** Elasticsearch
**Created:** [February 21, 2015, 1:14pm UTC](https://discuss.elastic.co/t/elasticsearch-giving-incorrect-result-when-using-must-not-operator-alongwith-must-operator/22308 "2015-02-21T13:14:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sandeep\_kaushal\_verm](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@sandeep\_kaushal\_verm](https://discuss.elastic.co/u/sandeep_kaushal_verm)
#### Post date: [February 21, 2015, 1:14pm UTC](https://discuss.elastic.co/t/elasticsearch-giving-incorrect-result-when-using-must-not-operator-alongwith-must-operator/22308/1 "2015-02-21T13:14:43Z")

</div>

example

Query  
GET /beta/user/\_search?routing=1&q=\_id:54e5dc4817cf03cbbbe490e5  
{  
"from":0,  
"size":1,  
"filter":{  
"and":[  
{  
"query":{  
"nested":{  
"path":"event",  
"query":{  
"bool":{  
"must":[  
{  
"match":{  
"event.name":"e1"  
}  
},  
{  
"match":{  
"event.count":"4"  
}  
}  
]  
}  
}  
}  
}  
},  
{  
"query":{  
"nested":{  
"path":"event",  
"query":{  
"bool":{  
"must\_not":{  
"match":{  
"event.name":"e2"  
}  
}  
}  
}  
}  
}  
}  
]  
}  
}

Any help will be appreciated

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ee8b1176-49ea-4a7c-921c-fca8f45c7af5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ee8b1176-49ea-4a7c-921c-fca8f45c7af5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 12:31am UTC](https://discuss.elastic.co/t/elasticsearch-giving-incorrect-result-when-using-must-not-operator-alongwith-must-operator/22308/2 "2017-07-06T00:31:03Z")

</div>


