Tire Elasticsearch Rails not able to filter out null values

269 views Asked by At

I am trying to filter out values with null fee in the Tire results:

And this is the section of code:

    if not fees_low.blank? and not fees_high.blank?
         filter :range, "fees" => {gte: fees_low, lte: fees_high} 
         filter :exists, { :field => "fees" }
    end

I read that 'exists' filter removes null values as elasticsearch sees null fields as if they don't exist.

But in results of the above code, I can still see records with null fees.

On the other hand, if I apply the following filter, there are no records returned. This got me really confusing.

 filter :missing, { :field => "fees" }

How should I remove the records with null fees from my result?

0

There are 0 answers