What does bool query with must and should on same level means ?
I saw the query bellow:
{
"query": {
"bool": {
"must":
[{
"match": {
"content": {
"reporter": "Ricky"
}
}
}],
"should":
[{
"match": {
"header": {
"query": "nature"
}
}
}]
}
}
}
- According to Improving search relevance with boolean queries
mustmeansand,shouldmeansor - In the query above
mustandshould("and" and "or") are on the same level.
- So what does this bool query mean ?
- Does
shouldcontributes here to the final score (ifmustquery dosn't take any place) ?
CodePudding user response:
must should is only about search relevance improvement and not just and or
the above query means: find me all document whose
contentfield contains "ricky" and give a little boost to those documents also having "nature" in theirheaderfield.The query in
mustMUST be met, i.e. if no document contain "ricky" in theircontentfield, there won't be any match in the result set.
