I have to make aggregation about actor's movies by tag
For exemple, I want to see all movie's tag for Robert Deni Jr. ex : action (10) blockbuster (4) romance (2)
If my user filter Robert Deni Jr. movies by a tag (action) filters need to be update. If I check romance then : action (1) blockbuster(2) romance (2)
This is my mapping :
"mapping": {
"actor": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text"
},
"movies": {
"type": "nested",
"properties": {
"id": {
"type": "keyword"
},
"studio": {
"type": "nested",
"properties": {
"id": {
"type": "keyword"
},
"label": {
"type": "text"
}
}
},
"tags": {
"type": "nested",
"properties": {
"id": {
"type": "keyword"
},
"label": {
"type": "text"
}
}
}
}
}
}
}
}
}
And this is my query
{
"query": {
"bool": {
"filter": [
{
"match": {
"id": {
"query": 587
}
}
},
{
"bool": {
"must": [
{
"nested": {
"path": "movies",
"query": {
"nested": {
"path": "movies.tags",
"query": {
"term": {
"movies.tags.id": {
"value": 5189,
"boost": 1
}
}
}
}
}
}
}
]
}
}
]
}
},
"aggs": {
"tags": {
"nested": {
"path": "movies.tags"
},
"aggs": {
"tags": {
"terms": {
"field": "movies.tags.id",
"size": 100
}
}
}
}
}
}
My aggregation ignore the given tag. I can filter by a tag or not, the aggregation results don't change.
Any ideas ?