Filter missing field, with OR condition

I have a deleted_at column, which can be null. And I want to make query
like this :

"delete_is is not null OR deleted_at >= #{Time.zone.now}" 

My code is:

Product.tire.search(:page => @properties[:page], :per_page =>
@properties[:per_page]) do |search|
search.filter :or, [{missing: { field: "deleted_at" } }, { range: {
deleted_at: { gte: Time.zone.now } } } ]
end

It does not work. When I remove 'range' conditions, it works.
Thanks you for your helps.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Tran,

Your example query include "delete_is",
but your code does not include "delete_is".

And "missing filter" find only "missing" field, not equal "not null".

Please check your query or code.


Jun Ohtani
johtani@gmail.com
twitter : http://twitter.com/johtani

On 2013/09/22, at 17:53, Tran Quy Doan quydoantran@gmail.com wrote:

I have a deleted_at column, which can be null. And I want to make query like this :

"delete_is is not null OR deleted_at >= #{Time.zone.now}" 

My code is:

Product.tire.search(:page => @properties[:page], :per_page => @properties[:per_page]) do |search|
search.filter :or, [{missing: { field: "deleted_at" } }, { range: { deleted_at: { gte: Time.zone.now } } } ]
end

It does not work. When I remove 'range' conditions, it works.
Thanks you for your helps.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.