# Lucene query missing quotes after query\_string parsing with quoted string on not\_analyzed string field

**URL:** <https://discuss.elastic.co/t/lucene-query-missing-quotes-after-query-string-parsing-with-quoted-string-on-not-analyzed-string-field/18815>\
**Category:** Elasticsearch\
**Created:** [July 23, 2014, 9:35am UTC](https://discuss.elastic.co/t/lucene-query-missing-quotes-after-query-string-parsing-with-quoted-string-on-not-analyzed-string-field/18815 "2014-07-23T09:35:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frederik\_Vollert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederik_vollert/32/1389_2.png) [@Frederik\_Vollert](https://discuss.elastic.co/u/Frederik_Vollert)\
**Post date:** [July 23, 2014, 9:35am UTC](https://discuss.elastic.co/t/lucene-query-missing-quotes-after-query-string-parsing-with-quoted-string-on-not-analyzed-string-field/18815/1 "2014-07-23T09:35:12Z")

</div>

Hi there,

I am running ES 1.2.1, JRE build 1.7.0\_51-b13, OS X 10.9.4 and am trying to  
query with a "query\_string" query for an exact infix match within a  
not\_analyzed field containing punctuation or other special chars.

> <https://gist.github.com/fredv/503a5a64946cfee0bc9e>

Using /\_validate/query?explain I found out that the query with quotes is  
analyzed differently depending on the field queried being "not\_analyzed" or  
just of the standard-tokenized type "string". In the former case quotes are  
seemingly ignored leading to a query that looks wrong (for lucene because  
of the intentional quotes being removed):

query part:  
{  
"query": {  
"query\_string": {  
"query": "content\_test\_txt:("volume, offered")"  
}  
}  
}

not\_analyzed field:  
"explanations": [  
{  
"index": "index\_dev",  
"valid": true,  
"explanation": "(content\_test\_txt:volume, offered)"  
}  
]

analyzed field:  
{  
"query": {  
"query\_string": {  
"query": "content\_test:("volume, offered")"  
}  
}  
}

"explanations": [  
{  
"index": "index\_dev",  
"valid": true,  
"explanation": "(content\_test:"volume offered")"  
}  
]

The former is missing the quotes and the later is missing (due to query  
parsing, tokenization I assume) the for my search significant punctuation  
",".

Is this query parsing behavior intentional and is there another way to find  
exact matches containing possibly escape lucene special chars or  
punctuation?

I am grateful for any thoughts on this.

Thank you,  
Frederik

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bbd66542-df59-485f-815a-8c9e4ea9263f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bbd66542-df59-485f-815a-8c9e4ea9263f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:14am UTC](https://discuss.elastic.co/t/lucene-query-missing-quotes-after-query-string-parsing-with-quoted-string-on-not-analyzed-string-field/18815/2 "2017-07-06T01:14:02Z")

</div>

Closed on July 6, 2017, 1:14am UTC


