Our approach to make custom facet's order

Please see below

"aggs": {
"category": {
"terms": {
"field": "category.name",
"order": {
"sorting": "asc"
"aggs": {
"sorting": {
"avg": {
"field": "category.sortCode"

I think it's clear just from short viewing -we add special sorting field
and then get avg metrics for using at order

It is working -but i am not sure that is the only way or the most effective

Advice please

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/27805892-fb1c-4738-83d6-125f2e5d4212%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.