# Date Math Support in index names while defining SLM policy

**URL:** <https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613>\
**Category:** Elasticsearch\
**Tags:** slm-snapshot-lifecycle-management, snapshot-and-restore\
**Created:** [February 8, 2021, 2:27pm UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613 "2021-02-08T14:27:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParashB](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@ParashB](https://discuss.elastic.co/u/ParashB)\
**Post date:** [February 8, 2021, 2:27pm UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613/1 "2021-02-08T14:27:46Z")

</div>

Hi,

I want to backup only last months index using SLM policy and trying to use date Math while configuring the indices in SLM policy. Unfortunately, it doesn't work and can't find the index. However the same date math pattern works in dev tools.

Index Name : logs-2021.02

SLM policy :

```auto
PUT /_slm/policy/snapshot1
{
  "schedule": "0 35 4 * * ?", 
  "name": "<snap-{now/d}>", 
  "repository": "snapshot_1", 
  "config": { 
    "indices": ["%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E"] 
  }
}

```

Error details :

> "details" : """{"type":"index\_not\_found\_exception","reason":"no such index [%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E]", "resource.type":"index\_or\_alias","resource.id":"%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E","index\_uuid":"_na_","index":"%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E","stack\_trace":"[%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E] IndexNotFoundException[no such index [%3Clogs-%7Bnow%2FM%7Byyyy.MM%7D%7D%3E]]

Does SLM indices support date Math? If not, what is the alternative to snapshot only specific timeseries indices from a list of indices?

---

<div class="post-metadata">

**Author:** ![marcdk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcdk/32/83012_2.png) [@marcdk](https://discuss.elastic.co/u/marcdk)\
**Post date:** [February 25, 2021, 11:05am UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613/2 "2021-02-25T11:05:22Z")

</div>

Hi @ParashB

Have you managed to find a workaround for this?

Kind regards  
Marc

---

<div class="post-metadata">

**Author:** ![ParashB](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@ParashB](https://discuss.elastic.co/u/ParashB)\
**Post date:** [February 25, 2021, 11:36am UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613/3 "2021-02-25T11:36:38Z")

</div>

Hi Marc,

Yes, I did manage to make this work. Please find the SLM policy configuration:

```auto
{
  "schedule": "0 35 4 * * ?", 
  "name": "<snap-{now/d}>", 
  "repository": "snapshot_1", 
  "config": { 
    "indices": [<logs-*{now/M{yyyy.MM}}>
  }
}

```

Note that you need to insert the wildcard character although you don't have anything between logs & the date pattern.

---

<div class="post-metadata">

**Author:** ![marcdk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcdk/32/83012_2.png) [@marcdk](https://discuss.elastic.co/u/marcdk)\
**Post date:** [February 25, 2021, 12:04pm UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613/4 "2021-02-25T12:04:14Z")

</div>

Thank you @ParashB!

That did the trick

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 25, 2021, 12:05pm UTC](https://discuss.elastic.co/t/date-math-support-in-index-names-while-defining-slm-policy/263613/5 "2021-03-25T12:05:02Z")

</div>

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