# Filter with multiple should and minimum\_should\_match

**URL:** <https://discuss.elastic.co/t/filter-with-multiple-should-and-minimum-should-match/94715>\
**Category:** Elasticsearch\
**Created:** [July 27, 2017, 12:23am UTC](https://discuss.elastic.co/t/filter-with-multiple-should-and-minimum-should-match/94715 "2017-07-27T00:23:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![begemot](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@begemot](https://discuss.elastic.co/u/begemot)\
**Post date:** [July 27, 2017, 12:23am UTC](https://discuss.elastic.co/t/filter-with-multiple-should-and-minimum-should-match/94715/1 "2017-07-27T00:23:27Z")

</div>

Assume I need to filter result with documents where one string field, 'roles', in "Role1" OR another string field, 'groups', is "Group1"

```
GET /_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "name": "Alex"
          }
        }
      ],
      "filter": [
        {
          "bool": {
            "should": [
              {
                "terms": {
                  "roles": [
                    "Role1"
                  ]
                }
              },
              {
                "terms": {
                  "groups": [
                    "Group1"
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}

```

Do I need to use "minimum\_should\_match": 1 if at least one should with Role1 or should with Group1 be found?  
When parameter "minimum\_should\_match" is required in such type of filters ?

---

<div class="post-metadata">

**Author:** ![lukes](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lukes](https://discuss.elastic.co/u/lukes)\
**Post date:** [July 27, 2017, 11:08pm UTC](https://discuss.elastic.co/t/filter-with-multiple-should-and-minimum-should-match/94715/2 "2017-07-27T23:08:14Z")

</div>

When you are putting the filter at outer query level(With only should in inner level query), then you don't need the minimum\_should\_match at inner level unless you are putting must/filter/MUST\_NOT at inner level also. Because filter means MUST\_WITH\_CONSTANT/NO score, so your inner level query has to match atleast 1 clause.

---

<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:** [August 24, 2017, 11:08pm UTC](https://discuss.elastic.co/t/filter-with-multiple-should-and-minimum-should-match/94715/3 "2017-08-24T23:08:50Z")

</div>

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