JSON Query 1hr before and 1hr after epoch time

Hello -

I have an epoch date (in ms) and I'm trying to create a JSON query that gives me all records between 1 hour before and 1 hour after my epoch date.

Below is my query which is not working. Is there a "right" way to do this?

Thanks,
Butch

{
"range": {
"@timestamp": {
"gt": "1526002896000||-3600000",
"lt": "1526002896000||+3600000"
}
}

Hey, I think that's pretty much it but you'll want to add units at the end:

"gt": "1526002896000||-1h",
"lt": "1526002896000||+1h"

Are you getting any errors?

Thanks Jon - that worked!

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