ES 聚合指标
value_count: 计数
cardinality: 去重计数
avg: 平均值
sum: 求和
max: 最大值
min: 最小值
percentiles: 百分比
top_hits: 简单来说就是聚合分组后从每一个组取部分数据作为结果返回
查询UV
GET /nginx-log/_search
{ "size": 0,
"aggs": {
"uv": {
"cardinality": {
"field": "c_ip.keyword"
}
}
}
}
查询每天的uv
GET /nginx-log/_search
{
"size": 0,
"aggs": {
"groupBy": {
"date_histogram": {
"field": "@timestamp",
"interval": "day" //按天 比如按照7天: 7d, 按照月: month等
},
"aggs": {
"userCount": {
"cardinality": {
"field": "c_ip.keyword"
}
}
}
}
}
}
标签:uv,UV,查询,field,Elasticsearch,aggs,cardinality
From: https://www.cnblogs.com/flyhgx/p/16651624.html