【发布时间】:2019-06-14 04:33:03
【问题描述】:
我试图弄清楚如何在弹性搜索索引中总结许多不同的计数。索引中的文档如下所示:
{
'_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
}
}
}
}
如何总结索引中location、dates 和persons 中的所有不同单词?例如,如果另一个文档出现 2 次 Alex,我会得到 Alex: 3, Robert: 3, ..
【问题讨论】:
-
您需要出现次数或总和?两者都是不同的,都有不同的方式
-
@ashishtiwari 试图得到总和
-
我猜 sum 聚合对你有用 elastic.co/guide/en/elasticsearch/reference/current/…
-
@ashishtiwari 如果我不能明确写下该字段的名称(Alex、Robert、London 等),这将如何工作?
标签: elasticsearch elasticsearch-aggregation