Need help with query to aggregate and get data across objects

I have data in an index in this format:

doc1

doc1
{
	ports: {
		"80": 2,
		"443": 10,
		"23": 12
	}
}

doc2

{
	ports: {
		"80": 32,
		"44": 6,
		"22": 1
	}
}

I am trying to query and get an aggregate of data which calculates the total sum of these ports across different documents and get me the total. Something like this as shown below.

{
	topPorts: {
		"80": 34,
		"443": 10,
		"23": 12,
		"44": 6,
		"22": 1
	}
}

I tried various queries, going through a lot of forums and couldn't get anything that gave me desired results. Is there any way this can be solved using the Elasticsearch query or is it that the only solution to this is using painless script.

I am using Elasticsearch 7.10.2