The best option could be to compute that at index time.
On a client level or by using the new transform feature: 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-transform.html#mapping-transform

HTH
--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 23 juil. 2014 à 18:13, John Smith <[email protected]> a écrit :

Using ES 1.2.2


The below aggregation will give me my average requests per second and the 
average response times for each second.
Is this the only way to do it or is there better way? Since scripting is a bit 
slow?

"aggs": {
        "tps": {
          "date_histogram": {
            "field": "stampStart",
            "interval": "second",
            "order": {
              "_key": "asc"
            }
          },
          "aggs": {
            "avg_resp": {
              "avg": {
                "script": "doc.stampEnd.value - doc.stampStart.value"
              }
            }
          }
        }
      }
-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a618c94b-f79a-494a-9d12-0327cb9eff5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/5E2032FE-9D5C-4F94-8613-B47C276BAA64%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to