Must and should match doesn't return should matches

{
  "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.

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

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