timeesper

With Esper how to start a window for X minutes from first event timestamp?


I am trying to start a window and to make it lives for X minutes.

Select a,b
from Event.win:time(120) -> this gives me a sliding window
match_recognize(
partition by sensor
...
)

I tried also

Select a,b
from Event.win:ext_timed(time.time, 120) -> this gives me a sliding window as well
match_recognize(
partition by sensor
...
)

Is there a way to start a window for 120sec from the first coming event and to end it even new events are coming?

Thanks for your help


Solution

  • If you want a start processing events when a certain event/time occurred and stop processing after X minutes then that is done with contexts.

    create context FromNowForXSeconds start @now end after X seconds;
    context FromNowForXSeconds select ... from ....;