I've searched but could not find an answer to my problem. I've got a collection with this sample structure in MongoDB:
{
"_id": ObjectID(1),
"Manual_Tags": [
{
_source: {
tags: [ "tag1", "tag2", "tag3"]
other_values: ...
}
}
]
}
{
"_id": ObjectID(2),
"Manual_Tags": [
{
_source: {
tags: [ "tag2", "tag3", "tag4"]
other_values: ...
}
}
]
}
I need to know the count of instances for each value of "tags" existing in the collection for all documents (Manual_Tags[]._source.tags[]). That is, for the 2 documents in the sample above, the listing would be: tag1: 1 tag2: 2 tag3: 2 tag4: 1
Thanks in advance for any help.