有没有一种方法可以在多个过滤器上运行度量聚合(例如值计数)。例如,我目前能够通过以下聚合获得所有用户获得的成功和错误计数:
aggs = {
"f": {
"filters": {
"filters": {
"start_count": {"term": {"type": "Success"}},
"error_count": {"term": {"type": "Error"}}
}
},
"aggs": {
"counts": {"value_count": {"field": "type"}}
}
}
}
现在,假设我想获得特定用户玛丽、Joe和Tina的成功和错误计数。如何使用聚合和过滤器来实现这一点?
谢谢!
1条答案
按热度按时间mxg2im7a1#
您可以这样做,在您想要的三个用户上添加一个过滤器,然后在
user
字段上添加一个terms
聚合。成功/错误筛选器聚合将是用户的子聚合: