Lucene 7.1 comes with a new query, called the CoveringQuery. This is neat query that is like a bool query with should clauses but instead of global minimum should match for all documents it allows a minimum should match per document. I wonder how this new query can best be exposed in the ES query dsl?
It can be exposed in the bool query itself (via a minimum_should_match field or something like that), but that can be confusing as CoveringQuery Lucene query doesn't understand must, filter or must_not clauses and then we run into difficult to explain search results. At this moment I lean towards exposing this a separate query in the query dsl. I'm just not sure what the best name should be for this query, but I think the structure should look something like this:
{
"covering" : {
"minimum_should_match_field": "my_field",
"queries": [
{
# query1
},
{
# query2
},
# etc
]
}
}
The field specified in the minimum_should_match_field must be a number field with doc values not turned off. There is no need to worry about negative values, because the CoveringQuery treats a minimum should match of 0 and lower as 1.
I think that the match query should also get a new type named covering (or another name) and a minimum_should_match_field option that then under the hood uses the CoveringQuery instead of BooleanQuery or PhraseQuery.
Lucene 7.1 comes with a new query, called the CoveringQuery. This is neat query that is like a bool query with should clauses but instead of global minimum should match for all documents it allows a minimum should match per document. I wonder how this new query can best be exposed in the ES query dsl?
It can be exposed in the
boolquery itself (via aminimum_should_matchfield or something like that), but that can be confusing asCoveringQueryLucene query doesn't understand must, filter or must_not clauses and then we run into difficult to explain search results. At this moment I lean towards exposing this a separate query in the query dsl. I'm just not sure what the best name should be for this query, but I think the structure should look something like this:The field specified in the
minimum_should_match_fieldmust be a number field with doc values not turned off. There is no need to worry about negative values, because theCoveringQuerytreats a minimum should match of 0 and lower as 1.I think that the
matchquery should also get a newtypenamedcovering(or another name) and aminimum_should_match_fieldoption that then under the hood uses theCoveringQueryinstead ofBooleanQueryorPhraseQuery.