I assume the problem is related to this issue. How to do && and || job building queries in NEST?
If I understand correctly, the combination of must and should should act as it should be as a booster, as he says below
bool > must > term1 > should > term2 > term3 > term4
This is due to the fact that, as soon as a logical request has a prerequisite, it should begin to act as a factor of increase. So in
previous you could return results that ONLY contain term1, this is clearly not what you want in the strict logical sense of the input.
Therefore, I changed my request to 2 questions with one of them with the "AND" operator. Thus, this one will behave as MUST, as it will force all search keywords to be found in the fields.
"from": 0, "size": 10, "explain": true, "query": { "bool": { "should": [ { "multi_match": { "type": "best_fields", "query": "hp 301", "fields": [ "MPN^9", "SKU^8" ], "operator": "and" } } , { "multi_match": { "type": "best_fields", "query": "hp 301", "fields": [ "Name.raw2^7.5", "Name^7" ] } } ] } }
source share