# Must and should match doesn't return should matches

**URL:** <https://discuss.elastic.co/t/must-and-should-match-doesnt-return-should-matches/326657>\
**Category:** Elasticsearch\
**Created:** [February 28, 2023, 7:00am UTC](https://discuss.elastic.co/t/must-and-should-match-doesnt-return-should-matches/326657 "2023-02-28T07:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksh117](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ksh117/32/117847_2.png) [@ksh117](https://discuss.elastic.co/u/ksh117)\
**Post date:** [February 28, 2023, 7:00am UTC](https://discuss.elastic.co/t/must-and-should-match-doesnt-return-should-matches/326657/1 "2023-02-28T07:00:00Z")

</div>

```auto
{
  "track_total_hits": true,
  "from": 0,
  "size": 20,
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "item_id": {
              "value": "item_value_1",
              "boost": 1
            }  
          }
        }
      ],
      "should": [
        {
          "term": {
            "item_id": {
              "value": "item_value_2",
              "boost": 1
            }  
          }
        },
        {
          "term": {
            "item_id": {
              "value": "item_value_3",
              "boost": 2
            }
          }
        }
      ]
    }
  }
}

```

Why this query shows only “item\_value\_1” document? “minimum\_should\_match” also doesn’t show item\_value\_2 or item\_value\_3.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood1/32/101255_2.png) [@Mark\_Harwood1](https://discuss.elastic.co/u/Mark_Harwood1)\
**Post date:** [February 28, 2023, 7:58am UTC](https://discuss.elastic.co/t/must-and-should-match-doesnt-return-should-matches/326657/2 "2023-02-28T07:58:12Z")

</div>

Hi  
As soon as there is a mandatory clause in a bool (eg MUST or FILTER) then all SHOULD clauses are relegated to being optional extras or “nice to haves” on documents that match the mandatory clause.  
To make the SHOULD clauses mandatory ORs you need to wrap in a bool inside the must eg

Bool  
Must  
Term1  
Term2  
Bool  
Should  
Term3a  
Term3b

More background [here](https://discuss.elastic.co/t/explanation-of-terms-in-a-search/297523/6)

---

<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:** [March 28, 2023, 7:58am UTC](https://discuss.elastic.co/t/must-and-should-match-doesnt-return-should-matches/326657/3 "2023-03-28T07:58:51Z")

</div>

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