JSON Query 1hr before and 1hr after epoch time


(Butch) #1

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"
}
}


(Jon Budzenski) #2

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?


(Butch) #3

Thanks Jon - that worked!


(system) #4

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