I am trying to filter out any results that have an "Available Until" date in the past. However, if the "Available Until" date is null, I still want to return the result.
Here is the output that I need:
Available Until Date < today << this should not be returned
Available Until Date >= today << this should be returned
Available Until Date is null << this should be returned
I have looked at the following other stack overflow questions here and here, however, I believe both are in query context, whereas I need to use filter context.
Below is my code for what I have so far. How would I modify this to allow results with null values in "Available Until", using filter context?
var baseQuery = {
"size": 1000,
"query": {
"bool": {
"filter": [{
"range": {
"Product.AvailableUntil": {
"gte": "now"
}
}
}],
"must_not": [],
"should": [],
"must": []
}
}
};
Thank you for any help! :)