Follow-up to a discuss issue: https://discuss.elastic.co/t/to-get-end-date-of-week-in-date-histogram/116591/2
Displaying the value range that each histogram bar maps to can be problematic for the last bar of the histogram, since the histogram doesn't give the key that the next bucket would have. Is it something we should look into adding to the response?
I feel it'd be useful for each bucket to describe both of its bounds. The alternative is that you must assume that the upper bound of each bucket is the lower bound of the next one in the list, which needs a special case for the last bucket (as mentioned here), means that you must preserve the order of the list of buckets, and means you can't simply iterate through the buckets if you're doing some further calculations.
I'd expect there to be code out there that gets a bunch of day-long buckets and incorrectly assumes they're all 84600 seconds long, because that's way easier than trying to get the start time of the next bucket in the loop.
Discussed in FixitFriday: we agreed to put the from (inclusive) and to (exclusive) bounds of each bucket in the response.
Putting up my hand for this. If there is any additional context or initial thoughts please share.
Discussed in FixitFriday: we agreed to put the from (inclusive) and to (exclusive) bounds of each bucket in the response.
@jpountz to clarify would we be adding a from and to field to each bucket in the response?
@justinwyer Yes.
@jpountz @DaveCTurner do we just want to implement this for the histogram & date histogram aggregations? I see this is already implemented for the range histogram, I will follow that as a for the date histogram.
cc @elastic/es-search-aggs
Is this feature is implemented in current verison?
@markharwood
@ankitabhatt17 No, this has not been implemented. If this enhancement is added, this ticket will be updated/linked to the appropriate PR (or closed if we decide not to implement it).
Most helpful comment
@jpountz @DaveCTurner
do we just want to implement this for the histogram & date histogram aggregations?I see this is already implemented for the range histogram, I will follow that as a for the date histogram.