Aggregating object keys to achieve a sum

Hi @linkerc, thank your for your answer.

Actually, my document is now something like

{ "id":123, "topics": ["room", "kitchen", "room"], ... }

But I am not interested in the customer info when I am aggregating. I only want to know the count of the keyword repetitions inside the aggregation. So, if I have 1000 documents in one aggregation, I would count the number of times "room" appeared, also "kitchen" and 50 other keys.
I have a possible solution here but it's taking a looong time and I am trying to achieve a faster aggregation.