# How to perform exact match on wildcard field

**URL:** <https://discuss.elastic.co/t/how-to-perform-exact-match-on-wildcard-field/12727>\
**Category:** Elasticsearch\
**Created:** [July 9, 2013, 6:32pm UTC](https://discuss.elastic.co/t/how-to-perform-exact-match-on-wildcard-field/12727 "2013-07-09T18:32:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maya](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Maya](https://discuss.elastic.co/u/Maya)\
**Post date:** [July 9, 2013, 6:32pm UTC](https://discuss.elastic.co/t/how-to-perform-exact-match-on-wildcard-field/12727/1 "2013-07-09T18:32:42Z")

</div>

Hi,

We used the following query to get exact match on wildcard field:

"query\_string": {  
"query": ""abcddd"",  
"fields": [  
"\*.Name"  
]  
}  
}

but it returned results also for values, such as: abc, abcd, etc...

Does anyone has an idea how to get an exact match in such case? We tried to  
add "analyzer:simple", but it made things worse and sometimes didn't return  
results at all.

Many thanks.

Maya

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 16, 2013, 10:15am UTC](https://discuss.elastic.co/t/how-to-perform-exact-match-on-wildcard-field/12727/2 "2013-07-16T10:15:49Z")

</div>

Hi,  
I think the behaviour you see depends on your current mapping. Are you  
maybe indexing some of the fields using ngrams?  
Also, I don't quite get what you're trying to do with the quotation marks.  
Usually they are used with phrase queries, when you have multiple terms in  
order to say that those terms need to be close to each others.

Could you please post your mapping and clarify what you're trying to  
achieve?

On Tuesday, July 9, 2013 8:32:42 PM UTC+2, mayap wrote:

> Hi,
> 
> We used the following query to get exact match on wildcard field:
> 
> "query\_string": {  
> "query": ""abcddd"",  
> "fields": [  
> "\*.Name"  
> ]  
> }  
> }
> 
> but it returned results also for values, such as: abc, abcd, etc...
> 
> Does anyone has an idea how to get an exact match in such case? We tried  
> to add "analyzer:simple", but it made things worse and sometimes didn't  
> return results at all.
> 
> Many thanks.
> 
> Maya

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:26am UTC](https://discuss.elastic.co/t/how-to-perform-exact-match-on-wildcard-field/12727/3 "2017-07-06T02:26:13Z")

</div>


