I have multiple match queries inside the should
clause. I would like to add another field match, which should be used only to boost scores and not increase the recall set.
I have the below query that is being used currently:
{
"query": {
"function_score": {
"query": {
"bool": {
"minimum_should_match": 1,
"should": [
{
"multi_match": {
"minimum_should_match": "2<50%",
"query": "cadbury sugar free chocolate",
"type": "best_fields",
"fields": [
"name^10",
"description^5"
],
"tie_breaker": 1
}
},
{
"term": {
"name.raw": {
"value": "cadbury sugar free chocolate",
"boost": 10
}
}
},
{
"nested": {some nested should query}
},
{
"nested": {some nested should query 2}
}
]
}
},
"functions": [
{some function boost},
{some function boost 2}
],
"score_mode": "sum",
"boost_mode": "sum"
}
},
"from": 0,
"size": 20
}
As you can see I have 4 matches in should
among them, either one match is mandatory for a document to be relevant.
Now I need to introduce a new field brand
. From the above result set all the documents should be boosted that have brand:cadbury
but should not extract any new document that matches this condition.
I tried adding one more match(with boost) inside should
for the brand field, but this increases my recall set.
How do I solve this?