Exact Match Query


(Stanislas Polu) #1

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


(Tanguy) #2

Have you tried to index the string array field as keyword and use a terms
filter?
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


(Stanislas Polu) #3

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 | Realtime Photo
Search

On Thu, May 31, 2012 at 1:10 PM, Tanguy tlrx.dev@gmail.com wrote:

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

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


(Shay Banon) #4

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.comwrote:

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 | Realtime
Photo Search

On Thu, May 31, 2012 at 1:10 PM, Tanguy tlrx.dev@gmail.com wrote:

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

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


(system) #5