Pipeline aggregation on average aggregation


Having index contain these fields: user_id and score (integer between 0-100).
Need to do the following:
1. Calculate average score per user.
2. Create 4 buckets with the count of users score:
  Bucket 1: users with average score 0-25
  Bucket 2: users with average score 26-50
  Bucket 3: users with average score 51-75
  Bucket 4: users with average score 76-100

According to my readings I found that:
1. It is not possible to perform pipeline bucket aggregation with average as input.
2. It is not possible to pass sub-aggregation to average aggregation.

Keep in mind that the number of distinct users in the index might be hundred of thousands so it is a major performance issue to retrieve the average aggregation results (needs pagination) and process it in the code.

How can that be accomplished?   

I will appreciate any help on that.

Thanks a lot

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