Order of aggregations

Hi guys!

Someone can help me to understand the order of aggregations please?

I have this request with these aggregations:

"aggs": {
"coneixements": {
"terms": {
"field": "coneixements.keyword",
"size": 20,
"execution_hint": "global_ordinals"
}
},
"sexe": {
"terms": {
"field": "sexe.keyword",
"size": 3,
"execution_hint": "global_ordinals"
}
},
"valoracio": {
"terms": {
"field": "valoracio.keyword",
"size": 3,
"execution_hint": "global_ordinals"
}
}
}

But the result is in another order:

"valoracio": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Normal",
"doc_count": 715787
},
{
"key": "Bo",
"doc_count": 34542
},
{
"key": "Fluix",
"doc_count": 18038
}
]
},
"coneixements": {
"doc_count_error_upper_bound": 5710,
"sum_other_doc_count": 338545,
"buckets": [
{
"key": "Carnet B1",
"doc_count": 277033
},
{
"key": "Carnet Manipulador",
"doc_count": 55677
},
{
"key": "Excel",
"doc_count": 29867
},
{
"key": "Word",
"doc_count": 29552
},
{
"key": "Office",
"doc_count": 24318
},
{
"key": "Mecanografia",
"doc_count": 23455
},
{
"key": "Comptabilitat",
"doc_count": 21786
},
{
"key": "Logística",
"doc_count": 11706
}
]
},
"sexe": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Home",
"doc_count": 430610
},
{
"key": "Dona",
"doc_count": 337739
},
{
"key": "Indiferent",
"doc_count": 18
}
]
}

Order of request --> coneixements - sexe - valoracio
Order of the result --> valoracio - coneixements - sexe

Thanks!

JSON as a standard does not guarantee the order of keys in a map, so we cannot either.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.