Skip to content

How to expose the new Lucene CoveringQuery in the query dsl? #26915

@martijnvg

Description

@martijnvg

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.

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions