I'm trying to figure out how to sum up many different counts in an elasticsearch index. A document in the index looks like this:
{
'_source': {
'my_field': 'Robert and Alex went with Robert to play in London and then Robert went to London',
'ner': {
'persons': {
'Alex': 1,
'Robert': 3
},
'organizations': {},
'dates': {},
'locations': {
'London': 2
}
}
}
}
How can I sum up all the different words in location, dates and persons in the index? For example if another document had 2 occurrences of Alex, I'd get Alex: 3, Robert: 3, ..