I am making a product category page with Elasticsearch used for aggregations. As far as I know, ES can only do "_count", "_term" and by sub-aggregation for ordering the aggregation results with DSL.
My aggregation field is a string field and not analyzed but contains documents like "23 EU, 24 EU, 23 Toddler, etc.."
Here is my code snippet using elastic-builder package
"aggs":{
"ProductFilters.Size":{
"terms":{
"field":"ProductFilters.Size",
"size":52,
"order":{
"_term":"asc"
}
}
},
"ProductFilters.Size_count":{
"cardinality":{
"field":"ProductFilters.Size"
}
}
}
however this code generates a result like this. I want this results generated like in the way a human being would like not 10 after 1 but 2.
- 1 US Youth (38)
- 1 Youth (3)
- 10 Toddler (3)
- 10 US Toddler (48)
- 11 Toddler (3)
- 2 US Youth (37)
Is natural sorting on aggregations are possible with ElasticSearch?