Calculating Average of Average

(Nemo) #1

Hello Everyone,

I am trying to calculate Average of Average for the below data.

First I want to group the items and calculate the average of values. In the next Iteration, I want to calculate the average of the average what I calculated before. Currently I am able to get the first level average using below aggregation .

"aggs": {
        "item": {
          "terms": {
            "field": "item",
            "size": 0
          } , "aggs": {
            "value": {
              "avg": {
                "field": "value"

Can someone please help me to calculate the second level average?


(Mark Walkom) #2

You can't currently do that, pipeline aggs in ES 2.0 will do it though.

(Tarunsapra) #3

It's available in pipeline aggregation in ES 2.0 , you can read more about it here -

(system) #4