elasticsearch mean aggregation with term aggregation code example
Example: terms aggregation elasticsearch using Key order
GET /_search
{
"aggs": {
"genres": {
"terms": {
"field": "genre",
"order": { "_count": "asc" }
}
}
}
}