Simple equality filter

I feel like I must be missing something, but how do I filter on an exact
string match? In other words, I want either the entire field to match or not
at all.

The "text" filter of type "phrase" will match even when the query string is
only a subset of the field, and the "term" filter won't work when the field
is an identifier with hyphens in it.

Relatedly, is there a way to do an exact match on number and boolean fields?

-- Eric

You always do exact matches on number and boolean fields (using either term query or term filter). For text, you can make the field as index set to not_analyzed in order for it not to be analyzed and treated as a single token.

On Tuesday, June 14, 2011 at 7:38 PM, Eric Mill wrote:

I feel like I must be missing something, but how do I filter on an exact string match? In other words, I want either the entire field to match or not at all.

The "text" filter of type "phrase" will match even when the query string is only a subset of the field, and the "term" filter won't work when the field is an identifier with hyphens in it.

Relatedly, is there a way to do an exact match on number and boolean fields?

-- Eric

Thanks, that was what I was looking for!

On Tue, Jun 14, 2011 at 12:52 PM, Shay Banon
shay.banon@elasticsearch.comwrote:

You always do exact matches on number and boolean fields (using either
term query or term filter). For text, you can make the field as index set
to not_analyzed in order for it not to be analyzed and treated as a single
token.

On Tuesday, June 14, 2011 at 7:38 PM, Eric Mill wrote:

I feel like I must be missing something, but how do I filter on an exact
string match? In other words, I want either the entire field to match or not
at all.

The "text" filter of type "phrase" will match even when the query string is
only a subset of the field, and the "term" filter won't work when the field
is an identifier with hyphens in it.

Relatedly, is there a way to do an exact match on number and boolean
fields?

-- Eric