Interval between timestamps / duration of session

I could't find anything with heavy googling. Therefore I hope you could
help me here:

Imagine the following data:

{ timestamp: 123, id: abcd },
{ timestamp: 234, id: abcd },
{ timestamp: 543, id: abcd }
{ timestamp: 673, id: abcd }

I want to calculate the session length from this data in elastic search /
kibana. A session is continuous, if the timestamp interval between two
ordered entries is e.g. smaller than 200. According to the above data, two
sessions should be created:

1: 234-123 = 111 < 200 | session 1, duration 111
2: 543-234 = 311 > 200 | session 2, duration ...
3: 673-543 = 130 < 200 | session 2, duration 130

How can I achieve that in elastic search?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0ad8a0ca-4f60-4c52-ba7e-497099325d7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.