If I use the following aggregation as an example:
{
"aggs" : {
"actors" : {
"terms" : {
"field" : "actors"
},
"aggs" : {
"costars" : {
"terms" : {
"field" : "actors"
}
}
}
}
}
}
and the results look something like this:
"aggregations": {
"actors": {
"buckets": [
{
"key": "Harvey Keitel",
"doc_count": 1,
"costars": {
"buckets": [
{
"key": "Steve Buscemi",
"doc_count": 1
}, {
"key": "Uma Thurman",
"doc_count": 1
}, {
"key": "Bruce Willis",
"doc_count": 1
}
]
}
}
]
}
}
Is there any way to sort by the Actors with the most Costar bucket counts?