# Wildcard Search Issue

**URL:** <https://discuss.elastic.co/t/wildcard-search-issue/45172>\
**Category:** Elasticsearch\
**Created:** [March 23, 2016, 12:25am UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172 "2016-03-23T00:25:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nayakab](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nayakab](https://discuss.elastic.co/u/nayakab)\
**Post date:** [March 23, 2016, 12:25am UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172/1 "2016-03-23T00:25:17Z")

</div>

Hi ,

A wild card query to return the records matching country is as below :

{  
"query":{  
"filtered":{  
"filter":{  
"bool":{  
"must":[{"wildcard":{"Party.country" : "j\*"}}]  
} } } }}

This returns Australia and also "United Arab Emirates".  
This should only return Australia. Why is it considering Arab has a separate token even though the country field is not\_analyzed. Am i doing something wrong?

---

<div class="post-metadata">

**Author:** ![nayakab](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nayakab](https://discuss.elastic.co/u/nayakab)\
**Post date:** [March 23, 2016, 12:26am UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172/2 "2016-03-23T00:26:39Z")

</div>

Pasted the wrong query . The query is :

{  
"query":{  
"filtered":{  
"filter":{  
"bool":{  
"must":[{"wildcard":{"Party.country" : "a\*"}}]  
} } } }}

Appreciate any help on the same.

---

<div class="post-metadata">

**Author:** ![nayakab](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nayakab](https://discuss.elastic.co/u/nayakab)\
**Post date:** [April 1, 2016, 2:40am UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172/3 "2016-04-01T02:40:38Z")

</div>

Any suggestions?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [April 1, 2016, 11:07am UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172/4 "2016-04-01T11:07:58Z")

</div>

I suspect it depends on your mapping. The field you are querying is probably analyzed and tokenized on whitespaces, while you may want to use the keyword tokenizer instead but still lowercase it (as a token filter). You can do this using the put mapping api or specify a mapping as part of the create index call if you have one.

---

<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 5, 2017, 11:03pm UTC](https://discuss.elastic.co/t/wildcard-search-issue/45172/5 "2017-07-05T23:03:20Z")

</div>


