Try use sum buckets:
{
"size": 0,
"aggs": {
"group_by_ID": {
"terms": {
"field": "id",
"min_doc_count": 1
},
"aggs": {
"maxValue": {
"max": {
"field": "numValue"
}
}
}
},
"total": {
"sum_bucket": {
"buckets_path": "group_by_ID>maxValue"
}
}
}
}