# Special characters combined with wildcards issue

**URL:** <https://discuss.elastic.co/t/special-characters-combined-with-wildcards-issue/6837>\
**Category:** Elasticsearch\
**Created:** [February 29, 2012, 11:48am UTC](https://discuss.elastic.co/t/special-characters-combined-with-wildcards-issue/6837 "2012-02-29T11:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erling\_Wegger\_Linde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erling_wegger_linde/32/2070_2.png) [@Erling\_Wegger\_Linde](https://discuss.elastic.co/u/Erling_Wegger_Linde)\
**Post date:** [February 29, 2012, 11:48am UTC](https://discuss.elastic.co/t/special-characters-combined-with-wildcards-issue/6837/1 "2012-02-29T11:48:35Z")

</div>

Hi,

I've got an index with lots of different fields. Say that one of the  
many fields contain "Mr. x worked with C#, .Net and Java for 2 years"

Let's say I add a \* to the search queries, to be able to return  
results while the user is typing, i.e. a search for "Jav" is turned  
into "Jav\*", so that it matches "Java".

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:Jav\*"}}]}}},  
returns the correct document

However, when the user has completed spelling Java, the search query  
is then changed into "Java\*". That still works fine though.

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:Java\*"}}]}}},  
returns the correct document

When I search for ".Net" or "C#" with the appended "\*" this does not  
seem to work though.

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:C#\*"}}]}}},  
returns nothing

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:.Net\*"}}]}}},  
returns nothing

If I omit the "\*" it works fine:

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:C#"}}]}}},  
returns the correct document

{"query":{"bool":{"must":[{"query\_string":{"query":"\_all:.Net"}}]}}},  
returns the correct document

Obviously, I would like the "C#_" and ".Net_" queries to work. I've  
tried specifiying a "whitespace" tokenizer on the analyzer, but to me  
it seems the issue is with how the query is parsed/handled/escaped.  
Any advice on how to solve this issue would be greatly appreciated.

Thanks,  
Erling

---

<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, 3:37am UTC](https://discuss.elastic.co/t/special-characters-combined-with-wildcards-issue/6837/2 "2017-07-06T03:37:53Z")

</div>


