# Templates matching specific date patterns

**URL:** <https://discuss.elastic.co/t/templates-matching-specific-date-patterns/254972>\
**Category:** Elasticsearch\
**Created:** [November 10, 2020, 8:36pm UTC](https://discuss.elastic.co/t/templates-matching-specific-date-patterns/254972 "2020-11-10T20:36:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [November 10, 2020, 8:36pm UTC](https://discuss.elastic.co/t/templates-matching-specific-date-patterns/254972/1 "2020-11-10T20:36:50Z")

</div>

I have `day-wise` indices that are named like `prefix-yyyy-mm-dd` e.g `myindex-2020-10-01`, `myindex-2020-10-02` and so on. I want to re-index them into monthly indices named `prefix-yyyy-mm` e.g. `myindex-2020-10`, `myindex-2020-09` and so on.

If I have an existing `template` that has the pattern `myindex-*`, is there a way to alter the pattern so that it matches only the monthly indices?  
E.g. current

```
"order" : 0,
"index_patterns" : [
      "myindex-*"
],

```

to something like

```
"order": 1,
"index_patterns" : [
      "myindex-yyyy-mm"
],

```

Does this work? So that the former continues to match day-wise indices and latter matches only `monthly` indices?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 10, 2020, 10:48pm UTC](https://discuss.elastic.co/t/templates-matching-specific-date-patterns/254972/2 "2020-11-10T22:48:50Z")

</div>

The pattern matching is wildcard only, you can't use regex style patterns unfortunately.

---

<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:** [December 8, 2020, 10:48pm UTC](https://discuss.elastic.co/t/templates-matching-specific-date-patterns/254972/3 "2020-12-08T22:48:58Z")

</div>

Closed on December 8, 2020, 10:48pm UTC

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