# Minimum\_should\_match ignored when match only produces 1 term?

**URL:** <https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313>\
**Category:** Elasticsearch\
**Created:** [August 25, 2020, 3:21pm UTC](https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313 "2020-08-25T15:21:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Altiano\_Gerung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/altiano_gerung/32/38040_2.png) [@Altiano\_Gerung](https://discuss.elastic.co/u/Altiano_Gerung)\
**Post date:** [August 25, 2020, 3:21pm UTC](https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313/1 "2020-08-25T15:21:32Z")

</div>

```auto
"match": {
  "product.name.full": {
    "query": "chicken",
    "minimum_should_match": 3
  }
}

```

will always match,  
but if I provide it with input that can produce \>2 terms like this:

```auto
"match": {
  "product.name.full": {
    "query": "chicken wings",
    "minimum_should_match": 3
  }
}

```

it respects the `minimum_should_match`.

Why is it this way?  
And how do I ensure that a query must contains at least 3 terms when the user only input one?

---

<div class="post-metadata">

**Author:** ![KrishnaShah7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krishnashah7/32/66810_2.png) [@KrishnaShah7](https://discuss.elastic.co/u/KrishnaShah7)\
**Post date:** [August 26, 2020, 4:57am UTC](https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313/2 "2020-08-26T04:57:52Z")

</div>

Hi @Altiano_Gerung , I doubt there's any way to do it from the query side, unless we have any parameters that supports this functionality in future. As of now, the workaround could be-  
Writing a code in the painless script and attaching that to the ingest pipeline, which will dictate the field according to your requirements of the number of terms needed.

---

<div class="post-metadata">

**Author:** ![Altiano\_Gerung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/altiano_gerung/32/38040_2.png) [@Altiano\_Gerung](https://discuss.elastic.co/u/Altiano_Gerung)\
**Post date:** [August 31, 2020, 1:18am UTC](https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313/4 "2020-08-31T01:18:42Z")

</div>

Some advanced topics right there,

Could you point me for an example please?

---

<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:** [September 28, 2020, 1:18am UTC](https://discuss.elastic.co/t/minimum-should-match-ignored-when-match-only-produces-1-term/246313/5 "2020-09-28T01:18:44Z")

</div>

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