How to sum two value and do comparison under aggregation
<p>Can anyone assist me on how to sum of two value from two field( ts + duration) <strong>and</strong> compare if SUMVALUE is under a RANGE between startDate and endDate. And finally do a sorting under aggregation. Thank You</p>

<pre><code>{
  "_index" : "conn",
  "_type" : "logs",
  "_id" : "AVa8ThhDvPxUqjjShMXt",
  "_score" : 0.0,
  "_source" : {
    "ts" : "2016-08-24T11:26:26.066429Z",
    "uid" : "CBnx2VffmLzE5CvE7",
    "proto" : "udp",
    "duration" : 3.003767,
    "orig_bytes" : 696,
    "resp_bytes" : 0,
    "conn_state" : "S0",
    "local_orig" : false,
    "local_resp" : false,
    "missed_bytes" : 0,
    "history" : "D",
    "orig_pkts" : 4,
    "orig_ip_bytes" : 808,
    "resp_pkts" : 0,
    "resp_ip_bytes" : 0,
    "tunnel_parents" : [ ],
    "@version" : "1",
    "@timestamp" : "2016-08-24T11:26:26.066Z",
    "path" : "/usr/local/logs/current/conn.log",
    "host" : "oracle",
    "tags" : [ "conn" ],
    "id_orig_h" : "10.3.28.100",
    "id_orig_p" : 58548,
    "id_resp_h" : "239.255.255.250",
    "id_resp_p" : 1900
  }
} ]
 },
</code></pre>