I have multiple aggregations in my "query" see example. I use more aggregations sometimes. and I like to order the aggregations itself so "brand" is always on top of the aggregations list (in the result) and then "energy" for example?
If tried to figure it out myself but cant find anything that works.
{
"size": 1000,
"_source": ["id"],
"query": {
"bool": {
"must": [
{ "match": { "category_default": "2" }}
],
"must_not": [
{ "match": { "category_default": "2196" }},
{ "match": { "leverbaarheid_id": "3" }}
]
}
},
"aggs": {
"brand": {
"terms": {
"field": "brand.keyword",
"order": { "_term": "asc" }
}
},
"min_price": { "min": { "field" : "selling_price" } },
"max_price": { "max": { "field" : "selling_price" } },
"energy": {
"terms": {
"field": "energy.keyword",
"order": { "_term": "asc" }
}
}
}
}