你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
yayg2008
PUT flow/_doc/1 { "IPV4_SRC_ADDR":"192.168.1.1", "IN_BYTES":10, "OUT_BYTES":20 } PUT flow/_doc/2 { "IPV4_SRC_ADDR":"192.168.1.1", "IN_BYTES":30, "OUT_BYTES":40 } PUT flow/_doc/3 { "IPV4_SRC_ADDR":"192.168.1.2", "IN_BYTES":1000, "OUT_BYTES":5000 } PUT flow/_doc/4 { "IPV4_SRC_ADDR":"192.168.1.2", "IN_BYTES":1, "OUT_BYTES":5 } PUT flow/_doc/5 { "IPV4_SRC_ADDR":"192.168.1.3", "IN_BYTES":1111, "OUT_BYTES":2222 } GET flow/_doc/_search { "query":{ "match_all": {} } } POST flow/_doc/_search { "size":0, "aggs": { "group_by_ip": { "terms": { "field": "IPV4_SRC_ADDR.keyword", "order": { "inout_sums": "desc" }, "size": 2 }, "aggs": { "inout_sums": { "sum": { "script": { "source": "doc.IN_BYTES.value + doc.OUT_BYTES.value" } } } } } } } 返回结果: { "took": 2, "timed_out": false, "_shards": { "total": 5, "successful": 5, "skipped": 0, "failed": 0 }, "hits": { "total": 5, "max_score": 0, "hits": [] }, "aggregations": { "group_by_ip": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 2, "buckets": [ { "key": "192.168.1.2", "doc_count": 2, "inout_sums": { "value": 6006 } }, { "key": "192.168.1.3", "doc_count": 1, "inout_sums": { "value": 3333 } } ] } } }
要回复问题请先登录或注册
3 个回复
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
yayg2008
赞同来自:
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: