This is a snippet of my ES document:
"actions": [
{
"action_type": "special_offer",
"startdate": "2019-09-10 00:00:00",
"enddate": "2019-12-19 23:59:59"
},
{
"action_type": "clean_up",
"startdate": null,
"enddate": null
}
]
I would like to have all products with an action_type IN ('special_offer', 'clean_up', 'sell_off') and where the enddate is greater than now() OR the enddate is null.
This is how my query looks like now:
"query": {
"bool": {
"must": [
{
"nested" : {
"path": "article.actions",
"query" :{
"bool" : {
"should" : [
{ "match" : {"article.actions.action_type" : "sell_off"} },
{ "match" : {"article.actions.action_type" : "special_offer"} },
{ "match" : {"article.actions.action_type" : "clean_up"} }
],
"must": [
{
"range": {
"article.actions.enddate": {
"gte": "2019-10-24 00:00:00"
}
}
}
],
"minimum_should_match" : 1
}
}
}
}
]
}
}
I do not know how to add the OR condition (enddate is null).
Would be happy if someone can help me.