bucket aggregation return the count of documents for each bucket. I want to retrieve the documents within each bucket that matched that bucket criteria, then tried to add the following top_hits sub aggregation:
{
"aggregations": {
"myaggregation": {
"terms": {
"field": "title",
"size": 0,
"shard_size" :0
},
"aggregations": {
"hits": {
"top_hits": { "size": 100000 }
}
}
}
}
}
but This top_hits works very slow.
Is there any proper way to fetch the actual documents for each bucket after doing the terms aggregation quickly?