Let's say I got the below query, two match queries inside a should clause of a bool query.
I want to be able to conditionally select which queries inside my bool query are executed, I mean for example if the match query on the name field doesn't have results then don't bother executing the match query on the category field.
At least, is it possible to filter my results based on the score? I mean even if the second match query on the category field is executed, Would I be able to eliminate(filter) results coming from the second match query and keep only the results coming from the first?
{
"query": {
"bool": {
"should": [
{
"match": {
"name": {
"query": "textToSearch",
"fuzziness": 1,
"boost": 20
}
}
},
{
"match": {
"category": {
"query": "textToSearch",
"fuzziness": 1,
"boost": 10
}
}
}
]
}
}
}