How can I know average value of field "elapsed.time"

(Sergey) #1

I have my document with field "elapsed.time" I have to know average value of this field.
Many thanks for helping me!!!

(Adrien Grand) #2

You can use the avg aggregation, see

(Colin Goodheart-Smithe) #3

have a look at, this should achieve what you are after

(Sergey) #4

When i execute this aggs:
"aggs" : {
"avg_time" : {
"avg" : {
"field" : "elapsed.time"
I get answer
"hits": {
"total": 17776184,
"max_score": 1,
"hits": [......]
I wonder where is average value?

(Adrien Grand) #5

You should have an aggs element in the json response, it will be there.

(Sergey) #6

Ok, I've found it in the end of JSON response
Many thanks!

(system) #7