# Minimum should match with filter does not work properly

**URL:** <https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116>\
**Category:** Elasticsearch\
**Created:** [March 10, 2017, 9:15am UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116 "2017-03-10T09:15:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)\
**Post date:** [March 10, 2017, 9:15am UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/1 "2017-03-10T09:15:35Z")

</div>

Here is my query which used to work in 2.3.3 and stopped working in 5.2

POST test/\_search  
{  
"query": {  
"bool": {  
"filter": [  
{  
"term": {  
"deleted": false  
}  
}  
],  
"minimum\_should\_match": 1  
}  
}  
}

This query does not return any result when "minimum\_should\_match" is set. Is it a bug? I think the "minimum\_should\_match" parameter should apply to should clause only.

If this works as designed then NEST should not add this parameter when there is no should clauses.

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [March 10, 2017, 9:20am UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/2 "2017-03-10T09:20:39Z")

</div>

What the relation between a filter with a term query and minimum\_should\_match ? (MATCH !=== TERM)

---

<div class="post-metadata">

**Author:** ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)\
**Post date:** [March 11, 2017, 9:43am UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/3 "2017-03-11T09:43:37Z")

</div>

What do you mean by that?  
minimum\_should\_match tells how many should clauses on the same level should match for document to be a hit.  
In my case I dont have any should clauses so it should be ignored.

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [March 11, 2017, 6:26pm UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/4 "2017-03-11T18:26:06Z")

</div>

So remove it ^^

---

<div class="post-metadata">

**Author:** ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)\
**Post date:** [March 14, 2017, 2:11pm UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/5 "2017-03-14T14:11:21Z")

</div>

Yeah, the problem is that it comes from NEST and they deny this is a bug.

---

<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:** [April 11, 2017, 2:11pm UTC](https://discuss.elastic.co/t/minimum-should-match-with-filter-does-not-work-properly/78116/6 "2017-04-11T14:11:22Z")

</div>

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