Range Aggregation over Range type fields

Maybe I missed it but only query over Range fields are supported not aggregations.
A range Aggregation over a Range field would be very useful as well. Consider examples
A bank account was open from Jan 1 to Dec 30 2018 I need a report on number of open accounts by month. The way I handled it in the past (for fixed regular ranges representable as terms) was to index for each case an array of year and month between case open and close date (or today) or by developing java plugin which dynamically does similar thing. Both have disadvantages. The first one can increase size/time of the index but fast for analytics the second is slower and requires plugin development and deployment. Both suffer if I need precision to go to say weeks and when account durations go up. And of course it has no flexibility of real range aggregation - only works for fixed ranges such as years, months, weeks etc since it is represented as terms. And for open ended range it requires reindexing of active (accounts) at lease per smallest reporting interval (not an issue with plugin)
I guess another way to do it is to index array of dates between open and close with desired precision (i.e weeks) and do range aggregations over it

I wonder if there is a way to implement a smarter range aggregation over range fields with intersect and perhaps other interval matching logic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.