Hi,
I made this query and it gives me the results I'm looking for however I want to get the SUM where field wan_int matches wan1 (I got multiple wan interfaces). I tried adding filters and a query but I can't get it to work.
{
"size":"0",
"aggs": {
"range": {
"date_range": {
"field": "@timestamp",
"format": "YYYY/MM/DD, HH:mm:ss",
"ranges": [
{ "from": "now/1M" }
]
},
"aggs" : {
"switch_location" : {
"terms" : {
"field" : "location"
},
"aggs" : {
"total_bytes": {
"sum": {
"script" : "doc['in_bytes'].value + doc['out_bytes'].value"
}
}
}
}
}
}
}
}