# SearchParseException for query strings with parens in them?

**URL:** <https://discuss.elastic.co/t/searchparseexception-for-query-strings-with-parens-in-them/11466>\
**Category:** Elasticsearch\
**Created:** [April 5, 2013, 6:20pm UTC](https://discuss.elastic.co/t/searchparseexception-for-query-strings-with-parens-in-them/11466 "2013-04-05T18:20:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Phunk\_Gadoury](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Brian\_Phunk\_Gadoury](https://discuss.elastic.co/u/Brian_Phunk_Gadoury)\
**Post date:** [April 5, 2013, 6:20pm UTC](https://discuss.elastic.co/t/searchparseexception-for-query-strings-with-parens-in-them/11466/1 "2013-04-05T18:20:02Z")

</div>

Once we started getting more realistic data into our ElasticSearch index  
for manual testing purposes, we ran into SearchPhaseExecutionException for  
queries containing a paren.

Example query:

curl -X GET '[http://localhost:9200/myindex/mytype/\_search?'](http://localhost:9200/myindex/mytype/_search?') -d  
'{"query":{"bool":{"must":[{"query\_string":{"query":"town(","fields":["\_all"]}}]}}}'

Error message:

SearchPhaseExecutionException[Failed to execute phase [query\_fetch], total  
failure; shardFailures {[JJfyNzxcR4WKsY-0nJdoJA][dpla][0]:  
SearchParseException[[dpla][0]: from[-1],size[-1]: Parse Failure [Failed to  
parse source  
[{"query":{"bool":{"must":[{"query\_string":{"query":"town(","fields":["\_all"]}}]}},"size":10,"from":0}]]];  
nested: QueryParsingException[[dpla] Failed to parse query [town(]];  
nested: ParseException[Cannot parse 'town(': Encountered "" at line 1,  
column 5.  
Was expecting one of:  
 ...  
[SNIP FOR BREVITY]

What's the best practice for preventing parse errors like this. Is there  
documentation on this situation/requirement?

Thanks all!

-Phunk

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/searchparseexception-for-query-strings-with-parens-in-them/11466/2 "2017-07-06T02:42:33Z")

</div>


