# What do parentheses do in the Simple Query Syntax

**URL:** <https://discuss.elastic.co/t/what-do-parentheses-do-in-the-simple-query-syntax/51065>\
**Category:** Elasticsearch\
**Created:** [May 26, 2016, 1:39pm UTC](https://discuss.elastic.co/t/what-do-parentheses-do-in-the-simple-query-syntax/51065 "2016-05-26T13:39:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drs/32/8001_2.png) [@drs](https://discuss.elastic.co/u/drs)\
**Post date:** [May 26, 2016, 1:39pm UTC](https://discuss.elastic.co/t/what-do-parentheses-do-in-the-simple-query-syntax/51065/1 "2016-05-26T13:39:20Z")

</div>

The documentation for Simple Query Syntax says that

> `(` and `)` signify precedence.

What does this mean?

I've tried some queries with parentheses in them but I cannot figure out what they do. At first I thought it was like mathematical operators such that

```
+(term1 term2) = +term1 +term2

```

but that appears to not be the case.

Can someone provide an example where parentheses affect the query?

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [May 26, 2016, 3:45pm UTC](https://discuss.elastic.co/t/what-do-parentheses-do-in-the-simple-query-syntax/51065/2 "2016-05-26T15:45:13Z")

</div>

You can find the answer at the link below

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)

---

<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 5, 2017, 10:48pm UTC](https://discuss.elastic.co/t/what-do-parentheses-do-in-the-simple-query-syntax/51065/3 "2017-07-05T22:48:48Z")

</div>

Closed on July 5, 2017, 10:48pm UTC


