Sub agg depending on length of results

Hello. I have several fields, and I want to put each one as a sub agg of another one.

Say A->subAgg(B)->subAgg(C)->subAgg(D)

But I want them to be put depending on their number of results. If for example D has the most results as an aggregation I want it to be put at first, and the next one is the one containing the second most results, say A... etc like so D->subAgg(A)->subAgg(B)->subAgg(C)

How can I do that?

Afraid that isn't possible. Order of the aggregation in the tree determines which and how documents match the child sub-aggregations. We can't reorder the aggs predominantly for technical reasons, but also because it would break the counts and metrics. The generated counts/metrics are only valid in the order specified.

What are you trying to accomplish?

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