How to create a numeric not equals filter/query?


(T Vinod Gupta) #1

in the documentation, i see numeric range filters.. but i want to check for
a double field not equal to given value. currently im using not filter with
term filter.. it works but is that the most efficient way?

thanks

--


(Clinton Gormley) #2

On Sat, 2012-10-20 at 09:29 -0700, T Vinod Gupta wrote:

in the documentation, i see numeric range filters.. but i want to
check for a double field not equal to given value. currently im using
not filter with term filter.. it works but is that the most efficient
way?

That's the correct way.

Also note: you can use the range filter for numbers as well. The
numeric_range filter is intended for fields (numbers, dates, terms) that
have many many unique values. It works by building a field cache (ie
loading all values for the field into memory). It may be the right
filter to use for (eg) timestamp > yesterday. But if your use case is
(eg) age > 18, then you'd be better off using a range filter.

clint

--


(system) #3