'Sum aggregation on results of group top_hits bucket aggregation

Is it possible to aggregate on resulting buckets from a group_latest, top_hits aggregation?

For example, I have the following query and result has buckets with a value for parent-child-1.3-sales for each query match. I would like to aggregate (total) on this field. There may be thousands (> default shard size of 10000) of rows for the query match.

{
    "size": 0,
    "query": {
        "match": {
            "parent-child-1.keyword": "key-value"
        }
    },
    "aggs": {
        "group": {
            "terms": {
                "field": "parent-child-1.2.keyword"
            },
            "latestOne": {
                "group_latest": {
                    "top_hits": {
                        "size": 1,
                        "sort": [
                            {
                                "parent-child-1.3": {
                                    "order": "desc"
                                }
                            }
                        ],
                        "_source": {
                            "includes": [
                                "parent-child-1.3-sales"
                            ]
                        }
                    }
                }
            }
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source