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