I am building a date_histogram query using aggregations. Per bucket are two 
different aggregations. First aggregations summarizes the number of 
activities and second one builds the sum over sum(duration per activity).

My Query looks like this:

   "aggregations": {
        "over-time": {
            "date_histogram": {
                "field": "timestamp",
                "interval": "1M"
            },
            "aggregations": {
                "activities": {
                    "sum": {
                        "field": "activity-count"
                    }
                },
                "duration": {
                    "sum": {
                        "field": "activity-duration"
                    }
                }
           } 
        }
    }

Question: Required is a field containing the result of "activity-duration / 
activity-count". 

I would think about a scripted expression, but how to use it here. With ES 
1.4 the scripted_metrics was introduced (as experimental), but I think that 
is not what I am looking for. 

Any idea?

regards,
markus

-- 
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/984b97b5-4cfd-4393-a0ad-bb6bc6dd96f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to