i'm trying to update a query that was possible on ElasticSearch 2 and does not exist in ES7. it's this query below:
{
"filter":
{
"and":[
{
"or":[
{
"range":
{
"date_of_birth":
{
"lte": 5
}
}
},
{
"range":
{
"age":{
"gte": 15
}
}
}]
},{
"range":
{
"begin_time":
{
"lte": 23
}
}
}]
}
}
i am aware that i should use boolean queries but because it is a filter, i am confused and i would appreciate your help :)
There you go, just replace and
by bool/filter
and or
by bool/should
:
{
"query": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"range": {
"date_of_birth": {
"lte": 5
}
}
},
{
"range": {
"age": {
"gte": 15
}
}
}
]
}
},
{
"range": {
"begin_time": {
"lte": 23
}
}
}
]
}
}
}