# How to do wild card search for terms which has special characters in it

**URL:** <https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223>\
**Category:** Elasticsearch\
**Created:** [February 23, 2017, 1:27pm UTC](https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223 "2017-02-23T13:27:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [February 23, 2017, 1:27pm UTC](https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223/1 "2017-02-23T13:27:28Z")

</div>

I am using the following query

GET indexname/\_search  
{  
"query" : {  
"query\_string" : {  
"query" : "\* _036-192_ \*",  
"default\_field" : "partNumber"  
}  
}  
}

Now when I run this query m getting hit as null even though there are documents with 036-192.Looks like it's including \* also in the search term because of special character - in 036-192

Any way to sort this out

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 27, 2017, 9:05am UTC](https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223/2 "2017-02-27T09:05:38Z")

</div>

Hey,

please take yourself some time and read the [Search in depth](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/search-in-depth.html) in the definitive guide to make sure you understand how full text search in Elasticsearch/Lucene works. It is different to SQL or a any regex based search. You can create a specific search (in combination with analysis/mapping on index time), that works much better than any regex based search when you are searching for such kind of ids (i.e. by splitting on dashes only, but using ngrams or edgengram etc, there are a couple of ways to solve this depending your use-case).

--Alex

---

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [February 27, 2017, 3:21pm UTC](https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223/3 "2017-02-27T15:21:14Z")

</div>

Thanks Alex

---

<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:** [March 27, 2017, 3:21pm UTC](https://discuss.elastic.co/t/how-to-do-wild-card-search-for-terms-which-has-special-characters-in-it/76223/4 "2017-03-27T15:21:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
