# How to create an index template that matches some indexes but not others?

**URL:** <https://discuss.elastic.co/t/how-to-create-an-index-template-that-matches-some-indexes-but-not-others/155067>\
**Category:** Elasticsearch\
**Created:** [November 1, 2018, 7:29pm UTC](https://discuss.elastic.co/t/how-to-create-an-index-template-that-matches-some-indexes-but-not-others/155067 "2018-11-01T19:29:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronloesattv](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@aaronloesattv](https://discuss.elastic.co/u/aaronloesattv)\
**Post date:** [November 1, 2018, 7:29pm UTC](https://discuss.elastic.co/t/how-to-create-an-index-template-that-matches-some-indexes-but-not-others/155067/1 "2018-11-01T19:29:43Z")

</div>

I'm trying to create an index template that matches all indexes except those that start with a period. I've tried the following but none work.

"index\_patterns": ["\*", "-.\*"] - this is accepted by the create API but still matches indexes that start with a period  
"index\_patterns": ["\*,-.\*"] - this is rejected by the create template API  
"index\_patterns" [" /@&~(\.@)/"] - this is rejected by the create template API

i would think the first should work but i've found areas where this does not work as expected (see [https://github.com/elastic/kibana/issues/17147](https://github.com/elastic/kibana/issues/17147))

We are currently using Elastic stack 6.4.2

---

<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:** [November 29, 2018, 7:40pm UTC](https://discuss.elastic.co/t/how-to-create-an-index-template-that-matches-some-indexes-but-not-others/155067/2 "2018-11-29T19:40:20Z")

</div>

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