title: Issue with nested aggregations ElasticSearch : doing a sum after a max
body: <p>I know sub aggregation isn't possible with metric aggregations and that Elasticsearch supports sub aggregations with buckets. But I am a bit lost on how to do this.</p>
  
  <p>I want to do a sum after nested aggregations and after having aggregated by max timestamp.</p>
  
  <p>Something like the code below, give me this error : "Aggregator [max_date_aggs] of type [max] cannot accept sub-aggregations" which is normal. Is there a way to make it works?</p>
  
  <pre><code>{
  "aggs": {
      "sender_comp_aggs": {
          "terms": {
              "field": "senderComponent"
          },
          "aggs": {
              "activity_mnemo_aggs": {
                  "terms": {
                      "field": "activityMnemo"
                  },
                  "aggs": {
                      "activity_instance_id_aggs": {
                          "terms": {
                              "field": "activityInstanceId"
                          },
                          "aggs": {
                              "business_date_aggs": {
                                  "terms": {
                                      "field": "correlationIdSet.businessDate"
                                  },
                                  "aggs": {
                                      "context_set_id_closing_aggs": {
                                          "terms": {
                                              "field": "contextSetId.closing"
                                          },
                                          "aggs": {
                                              "max_date_aggs": {
                                                  "max": {
                                                      "field": "timestamp"
                                                  },
                                                  "aggs" : {
                                                      "sum_done": {
                                                          "sum": {
                                                              "field": "itemNumberDone"
                                                          }
                                                      }
                                                  }
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>Thank you</p>