# Template index\_pattern matching

**URL:** <https://discuss.elastic.co/t/template-index-pattern-matching/249289>\
**Category:** Elasticsearch\
**Created:** [September 21, 2020, 1:31am UTC](https://discuss.elastic.co/t/template-index-pattern-matching/249289 "2020-09-21T01:31:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![szanin](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@szanin](https://discuss.elastic.co/u/szanin)\
**Post date:** [September 21, 2020, 1:31am UTC](https://discuss.elastic.co/t/template-index-pattern-matching/249289/1 "2020-09-21T01:31:09Z")

</div>

How do I ensure that only new indices get my template, and not the metrics or logs indices. If I define the "index\_pattern" to be "\*" that will apply to all new indices. Is there a way to specify that I don't want to apply the template to indices starting with "."?

The examples for index\_pattern are not very helpful, somehow we expect indices that share the same template to start with the same letter, like "t\*" etc. In my use case I have a list of more than 30 types of products that I want to share the same settings, and I don't want to add every product type to the index\_pattern list. On top of that, I want to be able to use the same template for all the new product types that might be added in the future, since I know that my ES cluster will always contain objects that belong to that category. Is there a way to achieve this, without changing the index name of all products?

So far the only solution I've found is to prepend a string to the index names so that I have them be like "q-abc", "q-xyz" etc. The index pattern matching seems to only allow for wildcard matching, is there a plan to implement something like RegEx or more advanced pattern matching solutions? Even just negating a condition would be helpful, like in my case applying the template to all indices that don't start with "."

Continuing the discussion from [Defining index mappings on ElasticSearch](https://discuss.elastic.co/t/defining-index-mappings-on-elasticsearch/248774/4):

---

<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:** [September 21, 2020, 2:02am UTC](https://discuss.elastic.co/t/template-index-pattern-matching/249289/2 "2020-09-21T02:02:06Z")

</div>

There's no way to set a "not match" type approach unfortunately.

I'd suggest you create a feature request on GitHub with your ideas 🙂

---

<div class="post-metadata">

**Author:** ![szanin](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@szanin](https://discuss.elastic.co/u/szanin)\
**Post date:** [September 21, 2020, 4:02am UTC](https://discuss.elastic.co/t/template-index-pattern-matching/249289/3 "2020-09-21T04:02:53Z")

</div>

Thanks for your reply, please see: [https://github.com/elastic/elasticsearch/issues/62681](https://github.com/elastic/elasticsearch/issues/62681)

@Russ_Cam FYI

---

<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:** [October 19, 2020, 4:02am UTC](https://discuss.elastic.co/t/template-index-pattern-matching/249289/4 "2020-10-19T04:02:57Z")

</div>

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