Counting the frequency of matching fields

Hi,

I am quite much a beginner with Elastic (and this forum).

I have an index, where conversations are stored into documents per user in the following way:

Document #1:

_id: 1
nickname: John_the_man
topic_1.comment_1: "This is great..."
topic_1.comment_2: "This is even better..."
topic_2.comment_1: "This new topic..."
...

Document #2:

_id: 2
nickname: Mary_the_boss
topic_1.comment_1: "Might be, yes..."
topic_2.comment_1: "On the other hand..."
topic_2.comment_2: "Actually..."
topic_3.comment_1: "Well..."
...

Document #3
...

Now I would like to understand the activity levels of the conversations. The challenge I see here is that there are multiple fields in a single document that need to be counted even in "wildcard" fashion.

Is there a way to count the number of comments by topic (or even the total number) over the whole index?

I think it is tricky to count the number of comments per topic given that each document can contain multiple comments for the same topic. I would try and restructure the documents so that it is easier to get out the info you need when querying. Maybe have a document per topic or even one per comment, depending on what other queries you need to run.

Thanks javanna. I agree the best way is to restructure my index or actually make a second index to to place the discussion comments as separate documents.