I think the bool request will do the trick.
{ "query": { "bool": { "should": [ { "range": { "deadline": { "gte": "2016-12-14" } } }, { "bool": { "must_not": { "exists": { "field": "deadline" } } } } ] } } }
Null values ββdo not exist in Elasticsearch indexes, so we are using an existing query. Using a missing query would be less verbose, but deprecated since 2.2 .
I donβt have enough information, so my example works in the context of the request, but perhaps the filter context will be more convenient in this case.
source share