# Exact string match query

**URL:** <https://discuss.elastic.co/t/exact-string-match-query/5550>\
**Category:** Elasticsearch\
**Created:** [October 10, 2011, 12:08pm UTC](https://discuss.elastic.co/t/exact-string-match-query/5550 "2011-10-10T12:08:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [October 10, 2011, 12:08pm UTC](https://discuss.elastic.co/t/exact-string-match-query/5550/1 "2011-10-10T12:08:05Z")

</div>

Hi;  
I want to have results of exact query match which should consider all  
case sensitiveness,along with number formats in the query.  
Suppose if i want to search for filename : "DoCument2.doc",query  
should return me only those results having filename as such.  
I closest i could get with such is term query but i observed that it  
does not support number format and gives null results for  
"DoCument2.doc".Have tried text query also but does gives some close  
matches results also.i m using no analyzers apart from default.  
Please help me out in this.  
thanks;  
Ajay

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [October 10, 2011, 12:33pm UTC](https://discuss.elastic.co/t/exact-string-match-query/5550/2 "2011-10-10T12:33:54Z")

</div>

On Mon, 2011-10-10 at 05:08 -0700, arien wrote:

> Hi;  
> I want to have results of exact query match which should consider all  
> case sensitiveness,along with number formats in the query.  
> Suppose if i want to search for filename : "DoCument2.doc",query  
> should return me only those results having filename as such.  
> I closest i could get with such is term query but i observed that it  
> does not support number format and gives null results for  
> "DoCument2.doc".Have tried text query also but does gives some close  
> matches results also.i m using no analyzers apart from default.

There is the problem. By default your string values are being analyzed.  
If you want to match a string value exactly, then you must store the  
value in the correct form: in this case not analyzed.

You should set the mapping for that field to

{ type: "string", index: "not\_analyzed" }

clint

---

<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:52am UTC](https://discuss.elastic.co/t/exact-string-match-query/5550/3 "2017-07-06T03:52:27Z")

</div>


