I have a query with an array of 'must' clauses. Two of those clauses have array of 'should' clauses in them as follows just providing pseuodocode here):
must: [
{ clause 1 },
{ clause 2 },
{ bool:
should: [
{clause3},
{clause4},
{clause5}
],
"minimum_should_match" : "1"
},
{ bool:
should: [
{clause6},
{clause7}
],
"minimum_should_match" : "1"
}
]
The requirement here is to build a series of AND conditions with inner ORs as below:
clause1 AND clasue2 AND (clause3 OR clause4 OR clause5) AND (clause6 OR clause7)
I m using Java High Level Rest Client BoolQueryBuilder (version 7.1.1).
When I set minimumShouldMatch(1), it builds it as a String value "minimum_should_match" : "1"(as shown above). My intention of providing it is to say that atleast one clause must match in each of the should clauses.
But, I m seeing some records in the results where both clause6 and clause7 do not match. Meaning these records just satisfy 'clause1 AND clasue2 AND (clause3 OR clause4 OR clause5)'
It looks like minimum should match set as 1 for each of the should clauses are not respected.
Can you please advise?