# Query String with - \_ symbols

**URL:** <https://discuss.elastic.co/t/query-string-with---symbols/16706>\
**Category:** Elasticsearch\
**Created:** [March 31, 2014, 4:30am UTC](https://discuss.elastic.co/t/query-string-with---symbols/16706 "2014-03-31T04:30:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkidkid](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zkidkid](https://discuss.elastic.co/u/zkidkid)\
**Post date:** [March 31, 2014, 4:30am UTC](https://discuss.elastic.co/t/query-string-with---symbols/16706/1 "2014-03-31T04:30:56Z")

</div>

Hi,  
I setup my index using standard tokenizer & two filter [ asciifolding &  
lowercase]  
I index data with - \_ symbols, eg: abc-xyz, abc\_xyz  
Then I use query\_string to search:

If my query is: - or \_ then nothing found (fine)  
But if my query is: 045 or 095 (ascii code of 2 above symbols)  
then my result will abc-xyz or abc\_xyz

I think it's look like query\_string had search on store field not in  
analyzed field isn't it ?

What should I do to avoid this problem ?

--  
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/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 31, 2014, 6:00am UTC](https://discuss.elastic.co/t/query-string-with---symbols/16706/2 "2014-03-31T06:00:18Z")

</div>

query\_string uses the same analyzer you used at index time. But if you don't set the field you are querying on, it will use \_all field which could have a different analyzer.

Elasticsearch does not search on stored field.

That said, I don't fully understand what you are doing here. Could you gist a full curl recreation?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 31 mars 2014 à 06:30, kidkid [zkidkid@gmail.com](mailto:zkidkid@gmail.com) a écrit :

Hi,  
I setup my index using standard tokenizer & two filter [asciifolding & lowercase]  
I index data with - \_ symbols, eg: abc-xyz, abc\_xyz  
Then I use query\_string to search:

If my query is: - or \_ then nothing found (fine)  
But if my query is: 045 or 095 (ascii code of 2 above symbols)  
then my result will abc-xyz or abc\_xyz

I think it's look like query\_string had search on store field not in analyzed field isn't it ?

What should I do to avoid this problem ?

--  
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/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CC814BB9-488E-419F-BCE4-EA7581CDAA3E%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/CC814BB9-488E-419F-BCE4-EA7581CDAA3E%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![zkidkid](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zkidkid](https://discuss.elastic.co/u/zkidkid)\
**Post date:** [April 1, 2014, 5:03am UTC](https://discuss.elastic.co/t/query-string-with---symbols/16706/3 "2014-04-01T05:03:31Z")

</div>

Hi David Pilato,  
It's what I read from Mastering Elasticsearch. I think the problem is  
Frontend dev have used an custom encode to trip html data.  
Thanks

On Monday, March 31, 2014 1:00:18 PM UTC+7, David Pilato wrote:

> query\_string uses the same analyzer you used at index time. But if you  
> don't set the field you are querying on, it will use \_all field which could  
> have a different analyzer.
> 
> Elasticsearch does not search on stored field.
> 
> That said, I don't fully understand what you are doing here. Could you  
> gist a full curl recreation?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 31 mars 2014 à 06:30, kidkid \<[zki...@gmail.com](mailto:zki...@gmail.com) \<javascript:\>\> a écrit :
> 
> Hi,  
> I setup my index using standard tokenizer & two filter [ asciifolding &  
> lowercase]  
> I index data with - \_ symbols, eg: abc-xyz, abc\_xyz  
> Then I use query\_string to search:
> 
> If my query is: - or \_ then nothing found (fine)  
> But if my query is: 045 or 095 (ascii code of 2 above symbols)  
> then my result will abc-xyz or abc\_xyz
> 
> I think it's look like query\_string had search on store field not in  
> analyzed field isn't it ?
> 
> What should I do to avoid this problem ?
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ef5bdca2-79fa-48ce-a9d3-52d5992ac456%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/7dfb46d0-8005-4288-b0f8-340b1688f814%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7dfb46d0-8005-4288-b0f8-340b1688f814%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:39am UTC](https://discuss.elastic.co/t/query-string-with---symbols/16706/4 "2017-07-06T01:39:09Z")

</div>


