Elastic Search by Date Range

Hello,

I want to see the logs for last 5 minutes from particular timestamp.

I am constructing elastic log url dynamically for alert message (with timestamp i.e the alert triggered time). For specifying date range for logs, i don't have context of start time. So i have to look for last 5 min logs (alert trigger for 5 min ).

Ex:

     start: "~5m ago" and end:alertTriggertrdTime
     logPosition=(end:alertTriggertrdTime,position:!n,start:~5m ago,streamLive:!f)

But didn't workout for me. Could you please help us on this issue.