How to calculate the overlap / elapsed time range in elasticsearch?


I have around million records in ES, they are different online meeting records that people join/leave at the different time.

{name:"p1", join:'2017-11-17T00:01:00.293Z', leave: "2017-11-17T00:06:00.293Z"}
{name:"p2", join:'2017-11-17T00:02:00.293Z', leave: "2017-11-17T00:04:00.293Z"}
{name:"p3", join:'2017-11-17T00:03:00.293Z', leave: "2017-11-17T00:05:00.293Z"}

Time range could be something like this:

 p1: [=========================]
 p2:      [==========]
 p3:            [==========]

The question is how to calculate the overlap time range happened last month, the example one should be 3 min, but I need to calculate the whole month different meetings

You could do a max aggregation on the join time, a min aggregation on the leave time and compute the difference between those two values on client-side.

@jpountz Thank you for that, but I need to get the result for the whole long period (e.g. a week/month) instead of single meeting call. Do you have any good idea to address that?

Is there no unique meeting id associated with these joins and leaves? Is it just one regularly scheduled meeting?

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