【发布时间】:2017-04-25 17:45:59
【问题描述】:
我是 elasticsearch 的新手,试图了解聚合和指标的工作原理。我特别运行了一个聚合查询来检索基于来自 elasticsearch 实例的 clientIPHash 的平均 bytesOut 数。我创建的查询(使用kibana)如下:
{
"size": 0,
"query": {
"filtered": {
"query": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": 1476177616965,
"lte": 1481361616965,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
}
}
},
"aggs": {
"2": {
"terms": {
"field": "ClientIP_Hash",
"size": 50,
"order": {
"1": "desc"
}
},
"aggs": {
"1": {
"avg": {
"field": "Bytes Out"
}
}
}
}
}
}
它给了我一些按 clientIPHash 分组的输出(应该是 avg),如下所示:
ClientIP_Hash: Descending Average Bytes Out
64e6b1f6447fd044c5368740c3018f49 1,302,210
4ff8598a995e5fa6930889b8751708df 94,038
33b559ac9299151d881fec7508e2d943 68,527
c2095c87a0e2f254e8a37f937a68a2c0 67,083
...
问题是,如果我用 sum 或 min 或任何其他度量类型替换 avg,我仍然会得到相同的值。
ClientIP_Hash: Descending Sum of Bytes Out
64e6b1f6447fd044c5368740c3018f49 1,302,210
4ff8598a995e5fa6930889b8751708df 94,038
33b559ac9299151d881fec7508e2d943 68,527
c2095c87a0e2f254e8a37f937a68a2c0 67,083
我检查了 kibana 生成的查询,似乎正确地放置了关键字“sum”或“avg”。我很困惑为什么我的 avg 和 sum 或任何其他指标的值相同。
【问题讨论】:
标签: elasticsearch