title: Do reserved characters need to be escaped in an Elasticsearch query?
body: <p>I may not be comprehending this correctly but when using the Query String Query to search my index, it states that reserved or special characters need to be escaped. </p>
  
  <p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/2.1/query-dsl-query-string-query.html#_reserved_characters" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/reference/2.1/query-dsl-query-string-query.html#_reserved_characters</a></p>
  
  <blockquote>
    <p>The reserved characters are: + - = &amp;&amp; || > &lt; ! ( ) { } [ ] ^ " ~ * ? : \ /</p>
  </blockquote>
  
  <p>Failing to escape these special characters correctly could lead to a syntax error which prevents your query from running."</p>
  
  <p>Currently my index does not tokenize special characters since I am using just the standard analyzer but I do have both analyzed and not analyzed on all string fields.  </p>
  
  <p>So if I have these strings indexed:</p>
  
  <pre><code>quick fox
  brown fox
  </code></pre>
  
  <p>When i run a query:</p>
  
  <pre><code>{
      "query_string" : {
          "query" : "(quick OR brown) AND fox",
      }
  }
  </code></pre>
  
  <p>The correct results come back.  But based on the reserved characters documentation should the query with the parentheses "(" and ")" need to be escaped in the query string query?  I am a bit confused on when to escape the reserved characters and when not to in the query?  </p>
  
  <p>Does it need to be?:</p>
  
  <pre><code>{
      "query_string" : {
          "query" : "\(quick OR brown\) AND fox",
      }
  }
  </code></pre>
  
  <p>I know that parentheses are used for grouping so it makes sense not to escape them.  But which reserved characters are always needed to be escaped in Elasticsearch's queries?  Only when the reserved characters are operators?</p>