Unable to calculate average bucket over multi layer data

I'm able to calculate average bucket score over one layer of data, but not on two lever hierarchy data.

A-parent-group m-group t-team 1
A-parent-group m-group t-team 4
A-parent-group n-group p-team 45
A-parent-group n-group p-team 34
A-parent-group n-group k-team 3

In above data, the average at group level can be calculated using bucketing at team level and I can get accurate results as
m-group: 2.5
n-group: 21.25

Now while I try to calculate average avg at parent group.
The bucketing at group level will give wrong output as: 29.83
but actually it should be 11.87

Pls help


I think it's more of a use-case thing, what the correct average would look like in this case... I would not have guessed 11.875 :slight_smile:

That said, you could go with a average bucket pipeline aggregation that actually has a very similar example than your usecase.

Hope that helps!


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