ES Aggregation hit that can fit multiple buckets should be in all buckets


(Ojamui) #1

Hey all

Im trying to solve a BI problem for my company, and we utilize ES for most of our statistics

Lets say i have 2 date fields in an entry. now lets say that those two dates are from the same date and are only a couple of hours apart. effectively those two fields combine to a date range of ( t0 < x < t1 )

now lets say i want a date histogram aggregation (or some other form of temporal bucket creation) that will tell me for each hour, if a hit was found.

Example, i have an entry with the data fields of 09:00 and 12:00 as the hours
i want that same single entry to be counted towards the buckets of 09:00-10:00, 10:00-11:00, and 11:00-12:00 - thus having a single hit counted in 3 different buckets

is this possible? if so then how?
Thanks in advance!


(David Pilato) #2

I think that Range Datatype can be helpful.

But unfortunately there is no built in yet range datatype agg.
On the other hand you can "easily" build a filter aggregation for each bucket you want and filter by using a range query.

That should work even though it requires you to write manually 24 filter aggs.


(system) #3

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