In ElasticSearch 6.8 I have indexed many documents that contains a collection of tags. The tags are mapped as keyword.

"tags": {
    "type": "keyword"
},

When doing

"query" : {
    "bool" : {
        "must" : { "match" : { "name" : "beach" } },
        "filter" : {
            "terms" : { "tags" : ["games", "cars"]  }
        }
    }
}

I get documents that contains at least one of those tags. But I want to filter out all documents that do not contains ALL the given tags.

I tried

"query" : {
    "bool" : {
        "must" : { "match" : { "name" : "beach" } },
        "filter" : {
            "terms" : { 
              "tags" : ["games", "cars"], 
              "minimum_should_match": 2 
            }
        }
    }
}

But it throws an error: "[terms] query does not support [minimum_should_match]"

Which would be the correct way of filtering out documents that do not contain those two tags? Note that the real query may contain other “should” clauses as well.

1