How to add time to Elasticsearch snapshot name?

Viewed 709

I want Elasticsearch snapshots named with date and time when they are created.

With the following template snapshot-YYYY-MM-dd_HH-mm-ss

Like this: snapshot-2020-05-25_22-58-13

How this can be done?

Elasticsearch documentation looks absolutely unclear about it, say no words and gives no example about time. I'm using v7.6 of Elasticsearch.

2 Answers

After some experiments I have found a solution. Here is the template that works:

<snapshot-{now{yyyy-MM-dd_HH-mm-ss|Europe/Oslo}}>

Note the time zone at the end. Without explicit time zone indication template generates time in UTC.

Related