Scripted field containing timestamp less 1 hour

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

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

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

That was it! Thank you for your response!

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