Inconsistent minimum_should_match in bool queries


(Robert Wittek) #1

I've set up an elasticsearch node with version 5.3.0, created an index and put a document inside.
I did the same setup with version 2.0.3.

Now I query with a bool query, once with minimum_should_match set to '1' and once to '0':

{
  "from": 0,
  "size": 8,
  "query": {
    "bool": {
      "must": {
        "query_string": {
          "query": "_all:*"
        }
      },
      "minimum_should_match": 1
    }
  }
}

Explicitly set to '0':

{
  "from": 0,
  "size": 8,
  "query": {
    "bool": {
      "must": {
        "query_string": {
          "query": "_all:*"
        }
      },
      "minimum_should_match": 0
    }
  }
}

In my understanding of the documentation, this should have the exact same result. On 2.0.3 these two queries return all documents. But with version 5.3.0, only the query with explicit '0' returns a document, the result of the first query is empty.

The documenation says, that a value below 1 is not used:

No matter what number the calculation arrives at, a value greater than the number of optional clauses, or a value less than 1 will never be used. (ie: no matter how low or how high the result of the calculation result is, the minimum number of required matches will never be lower than 1 or greater than the number of clauses.

Therefore it should have the same behavior with both queries.

Is this a bug, or is there something wrong with the query?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.