Hello Yuheng , I feel there are 2 approach.
1. Instead of storing the elements in an array , store it as 10 fields as in element_1 , element_2 and so on. And then do a stat aggregation on each field. 2. Try using the script facility here - http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations.html to retrieve the Nth element. Run stat script over it. Thanks Vineeth On Mon, Aug 18, 2014 at 4:42 AM, Yuheng Du <[email protected]> wrote: > Hi, > > I have a field called 'readings' in my logstash messages which is an array > consists of 10 float point numbers. > > I want to calculate the stats for each individual slots in those arrays. > For example if I have three readings : > > [0,0,0, 1935.25,0,0,0,0,-1235.5, 0] > [0,0,0, 1936.25,0,0,0,0,-1236.5, 0] > [0,0,0, 1937.25,0,0,0,0,-1237.5, 0] > > and I want the average to show me the average in each slot, which should > be: > [0,0,0, 1936.25,0,0,0,0,-1236.5, 0] > > > If I do: > > .... > aggs => { > reading_avg => { > avg => { > field => "readings" > } > } > }, > ..... > > Then ES will give me the average of all the 30 elements in this three > arrays and the average results in one number: 1930.54.... > > Does anyone has any suggestions how can I do this? > > Thanks. > > Yuheng > > -- > 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/9c665ba1-5e58-4a4d-a79a-b6acf1aef739%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/9c665ba1-5e58-4a4d-a79a-b6acf1aef739%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CAGdPd5kX%2BvjAunxexsFZ%3D2UO9JUhMX8y75166RQi5Y24ZhKwVg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
