I have an index with Elasticsearch which contains (inter alia) date and weight fields. I create a date histogram with bucket size year and I would like to calculate (in meta-language) sth like: sum(weight[year])/sum(weight[year-1]).
I can create an aggregation sum(weight), but how to calculate a faction of bucket-to-bucket values?
There is Serial Differencing Aggregation or Derivative, but it just subtracts the values between buckets and I need to divide them.
I will appreciate some clues how to achieve it.