Scripted field containing timestamp less 1 hour


(Butch) #1

Hello -

I would like to create a scripted field that takes my existing timestamp field and subtracts 1 hour.

What I have is:

timestamp_OMi
Language: painless
Type: date
Format: Date
Script: doc['@timestamp'].value - 3600000

When this is in place I receive a "Courier Fetch... shards failed" error.

Thanks for your help,
Butch


(Jen Huang) #2

You need to use .getMillis() to get the date in milliseconds:

doc['@timestamp'].value.getMillis() - 3600000


(Butch) #3

That was it! Thank you for your response!


(system) #4

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