such as title, I want to sum two variable using script syntax.
such as sum download1+download2 and upload1+upload2:
"aggs": {
"download1" : {
"filter" : { "term": { "IPV4_DST_ADDR":"120.127.160.91"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "IN_BYTES" } }
}
},
"download2" : {
"filter" : { "term": { "IPV4_SRC_ADDR":"120.127.160.91"} },
"aggs" : {
"downlod_bytes" : { "sum" : { "field" : "OUT_BYTES" } }
}
},"upload1" : {
"filter" : { "term": { "IPV4_DST_ADDR":"120.127.160.91"} },
"aggs" : {
"upload_bytes" : { "sum" : { "field" : "OUT_BYTES" } }
}
},"upload2" : {
"filter" : { "term": { "IPV4_SRC_ADDR":"120.127.160.91"} },
"aggs" : {
"upload_bytes" : { "sum" : { "field" : "IN_BYTES" } }
},
"aggs":{
"sum_bytes": {
"sum": {
"script": {
"source": "download1 + download2"//sum two variable.but I don't know how to write correct code here.
}
}
}
}
}
thank you in advance!