# Any performance difference between "must\_not" clause and "query\_string" with NOT operator?

**URL:** https://discuss.elastic.co/t/any-performance-difference-between-must-not-clause-and-query-string-with-not-operator/318729
**Category:** Elasticsearch
**Created:** [November 11, 2022, 11:09am UTC](https://discuss.elastic.co/t/any-performance-difference-between-must-not-clause-and-query-string-with-not-operator/318729 "2022-11-11T11:09:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)
#### Post date: [November 11, 2022, 11:09am UTC](https://discuss.elastic.co/t/any-performance-difference-between-must-not-clause-and-query-string-with-not-operator/318729/1 "2022-11-11T11:09:39Z")

</div>

Hi there,

I'm wondering, if there **is any performance gain** using `must_not` clause over to `query_string` using `NOT` operator (will be used inside `filter` and `should` clause).  
`query_string` has obviously shorter scripture, no relevance score needed.

`must_not:`

```auto
{
	"bool": {
		"must_not": [
			{
				"term": {
					"fieldA": {
						"value": "XYZ"
					}
				}
			}
		]
	}
}

```

`query_string:`

```auto
{
	"query_string": {
		"default_field": "fieldA",
		"query": "NOT XYZ"
	}
}

```

FieldA is a keyword.

Thanks

---

<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 9, 2022, 11:09am UTC](https://discuss.elastic.co/t/any-performance-difference-between-must-not-clause-and-query-string-with-not-operator/318729/2 "2022-12-09T11:09:58Z")

</div>

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