I'd like to plot the number of car trips ongoing on a particular day, every day for the last week. I know the start time and end time of the trips - the trips can last less than a day, or more than a day. Ultimately, I will allow the user to set the interval size (i.e. from every day, to every two days, etc.) and the date range (i.e. from the last week, to the last two weeks, etc.).
It looks like date histogram aggregation might help, but it appears to, in addition to the interval size, take a single date field from which to aggregate into buckets. In my case, as I only have the start and end times, I'd need some way for the histogram aggregator to calculate, based on start and end times, whether a given trip fits into a given interval bucket. Also, a given trip would potentially need to be counted in multiple buckets.
What's the best way to do this?