To mix ‘bool’ and ‘range’ queries in an Elastic query, add the range query to the array of queries:
GET documents/_search
{
"query": {
"bool": {
"must": [
{
"terms": {
"entityId": [
"-832106300000216000"
],
"boost": 1
}
},{
"range" : {
"pubyear" : {
"gte" : 2020
}
}
}
]
}
}
}