Description
This is basically the opposite of how the histogram currently acts: fixed interval and dynamic number of buckets.
My use case is that I would like to build a price range style aggregation for filtering products:
$0 - $100
$101 - $200
$201 - $300
$301 - $400
$401 - $500
While you can do this with the range agg. if you know in advance the lower and upper bounds of all your prices, I can't see a way to do this dynamically based off the current query. The range agg also suffers from other shortcomings such as generating buckets that may contain no documents.
Ideally, I'd like to be able to specify the number of ranges / buckets I want (eg. 5) with a dynamic interval calculated by the aggregation.
min_doc_count
could also come into affect here to ensure that either we don't generate buckets that don't contain any products (eg min_doc_count: 0
) and in which case the number of buckets just becomes a maximum number of potential buckets, rather than a guaranteed amount.