I think that you should use "should bool query" Boolean query | Elasticsearch Guide [8.11] | Elastic
Something like this:
POST /index/_search
{
"query": {
"bool": {
"filter": {
"bool": {
"should": [
{
"term": {
"myboolean": false
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "myboolean"
}
}
}
}
]
}
}
}
}
}
it should just remove all results where
mybooleanistrue
Don't you think you can simplify this with must not term filter myboolean:true?