title: multiple metric sub aggregations situation with ElasticSearch
body: <p>I am aware that Elasticsearch supports sub aggregations with bucketing (where bucketing aggregation can have bucketing or metric sub aggregations). Sub aggregation isn't possible with metric aggregations. May be that makes sense but here is the use case. </p>
  
  <p>I have <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html" rel="nofollow noreferrer">term aggregation</a> as a parent. And using another <code>term</code> aggregation as a child of it. child <code>term</code> has a child aggregation of type <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html" rel="nofollow noreferrer"><code>top_hits</code></a>. <code>top_hits</code> is a metric aggregation so it can't take any child aggregation. And now need to include <code>avg</code> aggregation into the mix. Given <code>top_hits</code> is the last aggregation in the aggregation tree can't have <code>avg</code> as a child to it since <code>top_hits</code> is a metric aggregation. </p>
  
  <p>following is the desired aggregation levels. (of course it's invalid given <code>top_hits</code> is a metric aggregation and true for <code>avg</code> aggregation too.</p>
  
  <pre><code>{
    "aggregations": {
      "top_makes": {
        "terms": {
          "field": "make"
        },
        "aggregations": {
          "top_models": {
            "terms": {
              "field": "model"
            },
            "aggregations": {
              "top_res": {
                "top_hits": {
                  "_source": {
                    "include": [
                      "model",
                      "color"
                    ]
                  },
                  "size": 10
                }
              }
            }
          }
        },
        "aggregations": {
          "avg_length": {
            "avg": {
              "field": "vlength"
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>What's the workaround or best way to address this?</p>