I want to aggregate documents and sort them by key length.
this query is aggregation query exclude 'ordering'.
{
"aggs": {
"per_terms": {
"terms": {
"field": "keyword"
}
}
}
}
So I want to order them by the length of terms from 'keyword' field.
How can I do this?