Hi!!
I have my document with field "elapsed.time" I have to know average value of this field.
Many thanks for helping me!!!
You can use the avg
aggregation, see https://www.elastic.co/guide/en/elasticsearch/reference/1.6/search-aggregations-metrics-avg-aggregation.html
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
@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?
You should have an aggs
element in the json response, it will be there.
@colings86
@jpountz
Ok, I've found it in the end of JSON response
Many thanks!