Exact matches on arrays


(Justin Case) #1

How can I query an array for exact matches? (mapping is not_analyzed).

e.g. I got a document with the tag [foo] and another one with the tags
[foo, bar]. Only the document with the [foo] tag should return. Right now
I'm using a script filter to limit the array
length: https://gist.github.com/justincase/b2efde40e19676df29c7. There must
be an easier (and less compute expensive) way though?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c69fc6bc-aba8-42ec-8000-b1f79bea18c2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #2

Concatenate the array to a string, index it, and use simple string prefix
matching.

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEOoamm3L0ChsyKxF%2B8wcq--hgWG9K3o02eKTP%3D72FwsA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Justin Case) #3

Thanks Jörg,

I was hoping for an easier solution but it will do for now.
Cheers.

On Jan 14, 2014, at 11:08 AM, joergprante@gmail.com wrote:

Concatenate the array to a string, index it, and use simple string prefix matching.

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/68FFBB8A-CE1D-47B4-934F-EEB0925EC1DD%40justincase.cx.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4