Are the aggregations in the response of an aggs search query ordered?

I could not find any explicit statement in the documentation of data range aggregation that talks about the ordering of the elements inside the aggregations field.
But I noticed that the results are always reverse of the date ranges in the query. Can this be taken as a guarantee of the ordering?

Some have an ordering and some don't. I don't know if the json response from date range is ordered off hand, but I mostly expect folks to use the key to resolve them.

The json spec doesn't attach any iteration order to json objects so we tend to use arrays when the order matters. It's possible for a json parser to jumble the iteration order of objects.

1 Like

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