elastic search aggregations group by where code example
Example: terms aggregation elasticsearch using Key order
GET /_search
{
"aggs": {
"genres": {
"terms": {
"field": "genre",
"order": { "_count": "asc" }
}
}
}
}