Hello. In my Elasticsearch setup (7.5.2) we have daily indices named myindex-2020.03.01, myindex-2020.03.02, .... I'm trying to setup a SLM policy that runs everyday and includes all indices for the past month.
For that I was trying to use the date math index name resolution in the indices
config list when creating the policy.
curl -X PUT "localhost:9200/_slm/policy/nightly-snapshots?pretty" -H 'Content-Type: application/json' -d'
{
"schedule": "0 30 1 * * ?",
"name": "<nightly-month-snap-{now/d}>",
"repository": "myrepo-backup",
"config": {
"indices": ["%3Cmyindex-%7Bnow%2FM%7Byyyy.MM.*%7D%7D%3E"]
}
}
'
Note: the indices
key decoded is "<myindex-{now/M{yyyy.MM.*}}>"
The policy is created properly but when I run it the snapshot created contains 0 indices instead of the corresponding indices of the month.
When I run the query GET /%3Cmyindex-%7Bnow%2FM%7Byyyy.MM.*%7D%7D%3E
in the Kibana dev tool console I get a proper output with the existing matching indices. Same proper behaviour when I run the query via curl:
curl -X GET http://localhost:9200/%3Cmyindex-%7Bnow%2FM%7Byyyy.MM.*%7D%7D%3E
Also, if I create a policy with a wildcard in the indices
key and run that policy, the snapshot created contains the desired indices.
curl -X PUT "localhost:9200/_slm/policy/nightly-snapshots?pretty" -H 'Content-Type: application/json' -d'
{
"schedule": "0 30 1 * * ?",
"name": "<nightly-month-snap-{now/d}>",
"repository": "myrepo-backup",
"config": {
"indices": ["myindex-2020.03.*"]
}
}
'
Can someone advice if the date math support is not available for this use case or am I doing something wrong? Or maybe it is a bug...
Thank you very much for your help.
Regards,
/José Carlos