# Sum two int variable in REST

**URL:** <https://discuss.elastic.co/t/sum-two-int-variable-in-rest/116967>\
**Category:** Elasticsearch\
**Created:** [January 25, 2018, 5:08am UTC](https://discuss.elastic.co/t/sum-two-int-variable-in-rest/116967 "2018-01-25T05:08:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![f26227279](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f26227279/32/21296_2.png) [@f26227279](https://discuss.elastic.co/u/f26227279)\
**Post date:** [January 25, 2018, 5:08am UTC](https://discuss.elastic.co/t/sum-two-int-variable-in-rest/116967/1 "2018-01-25T05:08:04Z")

</div>

Hi everyone, I want to sum two integer variable in REST API such like below:

```
  "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" } }
            }
        }
    }   

```

add download1 to download2 and add upload1 to upload2  
how can I do?

thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 22, 2018, 5:08am UTC](https://discuss.elastic.co/t/sum-two-int-variable-in-rest/116967/2 "2018-02-22T05:08:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
