Calculating Average of Average

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?

Thanks.

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

1 Like

It's available in pipeline aggregation in ES 2.0 , you can read more about it here - http://amsterdam.luminis.eu/2015/08/31/elasticsearch-2-0-and-pipeline-aggregations/

1 Like