Anyway to calculate the percentage of bucket value?

I want to calculate the percentage of each bucket regarding the total value. as an example;
let's assume we have sale per month calculated (for a couple of months) as follows:
month1 -> 10
month2 -> 25
month3 -> 15

I want to have the percentage of months too:
month1 -> 20%
month2 -> 50%
month3 -> 30%

I've tried bucket_script but as it is a parent pipeline aggregation I cannot have access to the total value and what I have access to is the statistics of that individual bucket.

Is there any way to pass the total value inside bucket_script?

Thanks in advance

1 Like

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