Hello
I try to make a movies / actor / tag aggregation for filter a list of movies.
For exemple, I want to see all movie's tag for Robert Deni Jr with filter like this : taf (nbMovie)
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)
There is my mapping and query.
When I perform the query, my aggregation seems to give me a non filter list of tag
Did I do something wrong ? I don't really understand.
"mapping": {
"actor": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text"
},
"videos": {
"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"
}
}
}
}
}
}
}
}
}
GET actors/actor/_search
{
"query": {
"bool": {
"filter": [
{
"match": {
"id": {
"query": 587
}
}
},
{
"nested": {
"path": "videos",
"query": {
"nested": {
"path": "videos.tags",
"query": {
"term": {
"videos.tags.id": {
"value": 2
}
}
}
}
}
}
}
]
}
},
"aggs": {
"videos": {
"nested": {
"path": "videos"
},
"aggs": {
"tags": {
"nested": {
"path": "videos.tags"
},
"aggs": {
"tags_id": {
"terms": {
"field": "videos.tags.id"
}
}
}
}
}
}
}
}