# Performance difference in 'must' and 'must\_not'

**URL:** https://discuss.elastic.co/t/performance-difference-in-must-and-must-not/210147
**Category:** Elasticsearch
**Created:** [December 2, 2019, 9:33am UTC](https://discuss.elastic.co/t/performance-difference-in-must-and-must-not/210147 "2019-12-02T09:33:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Prasiddha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasiddha/32/85618_2.png) [@Prasiddha](https://discuss.elastic.co/u/Prasiddha)
#### Post date: [December 2, 2019, 9:33am UTC](https://discuss.elastic.co/t/performance-difference-in-must-and-must-not/210147/1 "2019-12-02T09:33:57Z")

</div>

I wanted to know the performance difference between using 'must' clause and 'must\_not'.  
I am getting different timings trying from both of them.  
Suppose I have 10 groups, and I want to make 5 groups accessible to a user while 5 are excluded.  
So, i have two ways of using my query:

1. I can use 'must' clause inside a boolean query, and do must: ['1', '2' ,'3', '4', '5'].
2. I can use 'must\_not' clause inside a boolean query again, and do must\_not:['6', '7', '8', '9', '10']

I have not provided much details here because I just want to know more about the performance wise difference in using these two terms.  
I read about Boolean query in the ES document, and it said the scoring is ignored in 'must\_not' clause, although I have not yet understood how scoring is actually performed in Lucene index.  
But I am getting some timing differences, and 'must\_not' is taking longer time than 'must' and was curious to post about it.

Can anyone please explain the difference or explain both of the clauses in detail?  
Open to any kind of suggestions and answers.  
Thanks in advance.

---

<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: [December 30, 2019, 9:44am UTC](https://discuss.elastic.co/t/performance-difference-in-must-and-must-not/210147/2 "2019-12-30T09:44:48Z")

</div>

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