Elastic Search select doc only if all the values exist in the array

I have a bunch of products in my index and each product has this document structure
{
"id": 59342,
"days": [
{
"date": "2018-08-14",
"rate": 101.00
}
,
{
"date": "2018-08-15",
"rate": 200.00
}
,
{
"date": "2018-08-18",
"rate": 200.00
}
]
}
Now I want to get this document only if the days array contains all the dates between 2018-08-14 to 2018-08-16 . I have tried a couple of solutions but none have worked. Here is what I have so far
{
"query": {
"nested": {
"path": "days",
"query": {
"bool": {
"must": [
{
"match": {
"days.date": "2018-08-14"
}
},
{
"match": {
"days.date": "2018-08-15"
}
},
{
"match": {
"days.date": "2018-08-16"
}
}
]
}
}
}
}
}
Here is the mapping data of the products
{
"mappings": {
"products": {
"properties": {
"id": {
"type": "integer"
},
"days": {
"type": "nested",
"properties": {
"date": {
"type": "date"
},
"rate": {
"type": "double"
}
}
}
}
}
}
}

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