Skip to content

Combined Fields query minimum_should_match discrepancy for integer values #72148

@stevejgordon

Description

@stevejgordon

Elasticsearch version 7.13.0-SNAPSHOT
Plugins installed: n/a
JVM version: bundled
OS version: Windows 10

Description of the problem including expected versus actual behavior:

When testing the new Combined Fields query, I noticed a discrepancy with the minimum_should_match field which may be a bug. When sending an integer value for the minimum_should_match property it returns:

"type" : "x_content_parse_exception",
"reason" : "[1:115] [combined_fields] minimum_should_match doesn't support values of type: VALUE_NUMBER",

While it's described as a string in the documentation, examples elsewhere in the docs, show that an integer can be used. For the Match query, we have integration tests successfully sending an integer value too.

Steps to reproduce:

Send the following search:

POST http://127.0.0.1:9200/project/_search
{
    "query": {
        "combined_fields": {
            "query": "hello world",
            "fields": [
                "description",
                "myOtherField"
            ],
            "minimum_should_match": 2,
            "auto_generate_synonyms_phrase_query": false,
            "operator": "or",
            "zero_terms_query": "all",
            "boost": 1.1,
            "_name": "combined_fields"
        }
    }
}

Expected Result:

The search executes successfully.

Actual Result:

"type" : "x_content_parse_exception",
"reason" : "[1:115] [combined_fields] minimum_should_match doesn't support values of type: VALUE_NUMBER",

Sending the same query with the value as a string succeeds.

NOTE

Sending and integer value for this property in a Match query succeeds, so I'd expect the same behaviour in Combined Fields.

{
    "query": {
        "match": {
            "description": {
                "analyzer": "standard",
                "auto_generate_synonyms_phrase_query": false,
                "fuzziness": "AUTO:3,6",
                "fuzzy_rewrite": "top_terms_blended_freqs_10",
                "fuzzy_transpositions": true,
                "lenient": true,
                "minimum_should_match": 2,
                "operator": "or",
                "query": "hello world",
                "boost": 1.1,
                "_name": "named_query"
            }
        }
    }
}

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions