Sort aggs result by term from second level

Hello.
I have structure like this
POST /cars/test/_bulk { "index": {}} { "name": "record1", "category_id" : 1, "category_name" : "CCC"} { "index": {}} { "name": "record2", "category_id" : 2, "category_name" : "AAA"} { "index": {}} { "name": "record3", "category_id" : 3, "category_name" : "BBB"} { "index": {}} { "name": "record4", "category_id" : 2, "category_name" : "AAA"}

As you see I have a pairs: category_id + category_name
I want to get array of unique pairs category_id + category_name.
I have found that I can do it using aggregations.
And it's work
GET /cars/transactions/_search { "size": 0, "aggs": { "group_by_id": { "terms": { "field": "category_id" }, "aggs": { "group_by_name": { "terms": { "field": "category_name" } } } } } }

But what should I do to sort my result by category_name?
I tried to do something like this
"group_by_id": { "terms": { "field": "category_id", "order" : { "group_by_name.category_name": "asc" } }, ...
but it's not working.

Thank you