{
"mapping": {
"wafsecuritylog": {
"attack_type": {
"type": "keyword"
},
"dst_ip": {
"type": "keyword"
}
}
}
}
}
以上是我的map结构,我想实现统计dst_ip这个字段前10的数据,然后根据前10查出来的内容再统计出这个内容的attack_type前10的数据,有办法做到吗?
{
"aggs": {
"dst_ip_aggs": {
"terms": { "field": "dst_ip" }
}
}
, "size": 0
}
以上查询只能查出dst_ip的数据,查询结果如下:"buckets" : [
{
"key" : "172.25.1.111",
"doc_count" : 7839
},
{
"key" : "192.168.90.50",
"doc_count" : 6576
},
{
"key" : "-",
"doc_count" : 1690
}
]
,如何再根据出来的结果里的Key查attack_type的统计?
1 个回复
a2dou
赞同来自: hel2o
"aggs": {
"dst_ip_aggs": {
"terms": {
"field": "dst_ip"
},
"aggs": {
"attack_type_aggs": {
"terms": {
"field":"attack_type"
}
}
}
}
},
"size": 0
}