title: Elastic Search getting average of doc_count out of terms aggregation
body: <p>I have terms query as follow in elastic search.</p>
  
  <pre><code>GET http://localhost:9200/adapters/request/_search
  {
      "query": {
          "bool" : {
              "must" : {
                  "match" : { "adapterName" : "EnginePushableAdapter" }
              },
              "filter": {
                  "range" : {
                      "request.requestTime" : {
                          "gte" : 1492080226172,
                          "lte" : 1492080725964
                      }
                  }
              }
          }
      }, 
      "aggs" : {
          "call_count" : {
              "terms" : {
                  "field" : "deviceId"          
              }
          }
      }
  }
  </code></pre>
  
  <p>Is there a way to calcaulate the average of doc_count returned by terms aggregation?like this </p>
  
  <pre><code>    "avg_agg" : {
          "avg": { "field": "call_count.doc_count" }
  
      }
  </code></pre>
  
  <p>In other words, I want to take average of the previous aggregation fields.</p>