# Exact Match Query

**URL:** <https://discuss.elastic.co/t/exact-match-query/7925>\
**Category:** Elasticsearch\
**Created:** [May 31, 2012, 8:00am UTC](https://discuss.elastic.co/t/exact-match-query/7925 "2012-05-31T08:00:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stanislas\_Polu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stanislas_polu/32/2873_2.png) [@Stanislas\_Polu](https://discuss.elastic.co/u/Stanislas_Polu)\
**Post date:** [May 31, 2012, 8:00am UTC](https://discuss.elastic.co/t/exact-match-query/7925/1 "2012-05-31T08:00:35Z")

</div>

Hi guys.

Is there a way to query for exact match over a string array field  
(usernames in my case).

A terms filter on 'John' matches usernames such as 'John Doe'

Thanks!

-stan

---

<div class="post-metadata">

**Author:** ![Tanguy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy1/32/1749_2.png) [@Tanguy1](https://discuss.elastic.co/u/Tanguy1)\
**Post date:** [May 31, 2012, 11:10am UTC](https://discuss.elastic.co/t/exact-match-query/7925/2 "2012-05-31T11:10:53Z")

</div>

Have you tried to index the string array field as keyword and use a terms  
filter?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

-- Tanguy

Le jeudi 31 mai 2012 10:00:35 UTC+2, Stanislas Polu a écrit :

> Hi guys.
> 
> Is there a way to query for exact match over a string array field  
> (usernames in my case).
> 
> A terms filter on 'John' matches usernames such as 'John Doe'
> 
> Thanks!
> 
> -stan

---

<div class="post-metadata">

**Author:** ![Stanislas\_Polu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stanislas_polu/32/2873_2.png) [@Stanislas\_Polu](https://discuss.elastic.co/u/Stanislas_Polu)\
**Post date:** [May 31, 2012, 4:36pm UTC](https://discuss.elastic.co/t/exact-match-query/7925/3 "2012-05-31T16:36:11Z")

</div>

Nope. I'll try that!

Will this preserve the structure of the results I get?

Best,

-stan

--  
Stanislas Polu  
Mo: +33 6 83 71 90 04 | Tw: @spolu | [http://teleportd.com](http://teleportd.com) | Realtime Photo  
Search

On Thu, May 31, 2012 at 1:10 PM, Tanguy [tlrx.dev@gmail.com](mailto:tlrx.dev@gmail.com) wrote:

> Have you tried to index the string array field as keyword and use a terms  
> filter?
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-tokenizer.html)
> 
> -- Tanguy
> 
> Le jeudi 31 mai 2012 10:00:35 UTC+2, Stanislas Polu a écrit :
> 
> > Hi guys.
> > 
> > Is there a way to query for exact match over a string array field  
> > (usernames in my case).
> > 
> > A terms filter on 'John' matches usernames such as 'John Doe'
> > 
> > Thanks!
> > 
> > -stan

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 3, 2012, 9:50am UTC](https://discuss.elastic.co/t/exact-match-query/7925/4 "2012-06-03T09:50:03Z")

</div>

It will, you can also just set the index mapping option on the username  
field to not\_analyzed.

On Thu, May 31, 2012 at 6:36 PM, Stanislas Polu [polu.stanislas@gmail.com](mailto:polu.stanislas@gmail.com)wrote:

> Nope. I'll try that!
> 
> Will this preserve the structure of the results I get?
> 
> Best,
> 
> -stan
> 
> --  
> Stanislas Polu  
> Mo: +33 6 83 71 90 04 | Tw: @spolu | [http://teleportd.com](http://teleportd.com) | Realtime  
> Photo Search
> 
> On Thu, May 31, 2012 at 1:10 PM, Tanguy [tlrx.dev@gmail.com](mailto:tlrx.dev@gmail.com) wrote:
> 
> > Have you tried to index the string array field as keyword and use a terms  
> > filter?
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-tokenizer.html)
> > 
> > -- Tanguy
> > 
> > Le jeudi 31 mai 2012 10:00:35 UTC+2, Stanislas Polu a écrit :
> > 
> > > Hi guys.
> > > 
> > > Is there a way to query for exact match over a string array field  
> > > (usernames in my case).
> > > 
> > > A terms filter on 'John' matches usernames such as 'John Doe'
> > > 
> > > Thanks!
> > > 
> > > -stan

---

<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:25am UTC](https://discuss.elastic.co/t/exact-match-query/7925/5 "2017-07-06T03:25:50Z")

</div>


