# Inconsistent minimum\_should\_match in bool queries

**URL:** <https://discuss.elastic.co/t/inconsistent-minimum-should-match-in-bool-queries/82698>\
**Category:** Elasticsearch\
**Created:** [April 18, 2017, 10:44am UTC](https://discuss.elastic.co/t/inconsistent-minimum-should-match-in-bool-queries/82698 "2017-04-18T10:44:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robo-w](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@robo-w](https://discuss.elastic.co/u/robo-w)\
**Post date:** [April 18, 2017, 10:44am UTC](https://discuss.elastic.co/t/inconsistent-minimum-should-match-in-bool-queries/82698/1 "2017-04-18T10:44:25Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-minimum-should-match.html) 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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 16, 2017, 10:58am UTC](https://discuss.elastic.co/t/inconsistent-minimum-should-match-in-bool-queries/82698/2 "2017-05-16T10:58:16Z")

</div>

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