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


(Sergey) #1

Hi!!
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 https://www.elastic.co/guide/en/elasticsearch/reference/1.6/search-aggregations-metrics-avg-aggregation.html


(Colin Goodheart-Smithe) #3

have a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html, this should achieve what you are after


(Sergey) #4

@colings86
@jpountz
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

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


(system) #7