I’m trying to implement bucket sorting based on top_hits aggregation results.
Example of aggretions configured in query
"top_order_hits": {
"top_hits": {
"sort": [
{
"id": {
"order": "desc"
}
}
],
"_source": {
"includes": "id"
},
"size": 1
}
},
"aggs": {
"bucket_sort": {
"sort": [
{
"top_order_hits._source.id": {
"order": "asc"
}
}
],
"gap_policy": "insert_zeros",
"from": 0,
"size": 25
}
}
}
Executing this query returns an error
Validation Failed: 1: No aggregation found for path [top_order_hits._source.id];
I’ve also tried top_order_hits.sort
this results to another error
path not supported for [top_order_hits]: [sort]**
Is there any way to use bucket_sort
over top_hits
?
1