Avarage without outliers

Is it possible to find the avarage without outliers using elasticsearch query? Im still using elasticsearch 1.7...

Also an option to find the avarage of all the values below the 95th percentile

Thanks!

This is not possible . I guess you could get an approximation of this number by running a histogram aggregation on your field and then computing the weighted average of the bucket keys excluding keys that are above the 95th percentile on client side.

Or you could do it in two search requests: a first one that computes the 95th percentile and a second one that adds a filter so that values are below this 95th percentile and runs an average aggregation.

I saw this great article, but it uses version 2 features

Thanks