# Query\_string query operator precedence

**URL:** <https://discuss.elastic.co/t/query-string-query-operator-precedence/297183>\
**Category:** Elasticsearch\
**Tags:** eql-elastic-query-language\
**Created:** [February 14, 2022, 7:25pm UTC](https://discuss.elastic.co/t/query-string-query-operator-precedence/297183 "2022-02-14T19:25:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrFantastic2022](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MrFantastic2022](https://discuss.elastic.co/u/MrFantastic2022)\
**Post date:** [February 14, 2022, 7:25pm UTC](https://discuss.elastic.co/t/query-string-query-operator-precedence/297183/1 "2022-02-14T19:25:20Z")

</div>

Hello. When constructing a query\_string query, what is the precedence of the operators? For instance, the example given is **this AND that OR thus**. So does it AND this/that, then OR with thus? Or does it OR then AND? I'm thinking that it does the former. Also, I don't see where the number of possible boolean connectors is defined; how many does ES support? Thanks in advance to all who respond.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [February 14, 2022, 10:14pm UTC](https://discuss.elastic.co/t/query-string-query-operator-precedence/297183/2 "2022-02-14T22:14:07Z")

</div>

Lucene’s query\_string syntax does some [weird things](https://discuss.elastic.co/t/why-query-string-doesnt-honor-the-usual-precedence-rules/248779/3) beyond the usual expectations for and/or behaviour

---

<div class="post-metadata">

**Author:** ![MrFantastic2022](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@MrFantastic2022](https://discuss.elastic.co/u/MrFantastic2022)\
**Post date:** [February 15, 2022, 2:56pm UTC](https://discuss.elastic.co/t/query-string-query-operator-precedence/297183/3 "2022-02-15T14:56:49Z")

</div>

Thank you for that link

---

<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:** [March 15, 2022, 2:57pm UTC](https://discuss.elastic.co/t/query-string-query-operator-precedence/297183/4 "2022-03-15T14:57:38Z")

</div>

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