# Index template - exclude index seems not working

**URL:** <https://discuss.elastic.co/t/index-template-exclude-index-seems-not-working/331060>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 28, 2023, 12:54pm UTC](https://discuss.elastic.co/t/index-template-exclude-index-seems-not-working/331060 "2023-04-28T12:54:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepite](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@pepite](https://discuss.elastic.co/u/pepite)\
**Post date:** [April 28, 2023, 12:54pm UTC](https://discuss.elastic.co/t/index-template-exclude-index-seems-not-working/331060/1 "2023-04-28T12:54:14Z")

</div>

Hi everybody.

I dont find the correct syntax to exclude one index of an index pattern in index template

2 index template 🙂

**1st**

```auto
{
  "order": 0,
  "index_patterns": [
	"*_*","-tdir_business_prod-*"
  ],
  "settings": {
		"index.lifecycle.name": "Hot_toWarm_toCold_policy",
		"index.refresh_interval": "60s",
	  "index.number_of_shards": 1,
	  "index.number_of_replicas": 1
		}
  }

```

**2nd**

```auto
{
  "order": 1,
  "index_patterns": [
	"tdir_business_prod-*"
  ],
  "settings": {
	  "index.lifecycle.name": "Hot_toWarm_toCold_policy",
	  "index.refresh_interval": "60s",
	  "index.number_of_shards": 3,
	  "index.number_of_replicas": 1

		}
  }

```

In the first one i want to exclude : `-tdir_business_prod-*` to create the other indices with **1 primary shard and 1 replica**

In the second for `tdir_business_prod-*`, i would like to create this index with **3 primaries shards and 1 replica**

It's sure i make a mistake but i dont find which one ? 🙂

I change the `order` but KO too

**this one should have only 1 shard**

```auto
tdir_apr_business_prod-2023.04.27": {
		"settings": {
			"index.blocks.write": "true",
			"index.creation_date": "1682583561555",
			"index.creation_date_string": "2023-04-27T08:19:21.555Z",
			"index.lifecycle.name": "Hot_toWarm_toCold_policy",
			"index.number_of_replicas": "1",
			"index.number_of_shards": "3",

```

```auto
"tdir_business_prod-2023.04.27": {
		"settings": {
			"index.blocks.write": "true",
			"index.creation_date": "1682583560986",
			"index.creation_date_string": "2023-04-27T08:19:20.986Z",
			"index.lifecycle.name": "Hot_toWarm_toCold_policy",
			"index.number_of_replicas": "1",
			"index.number_of_shards": "3",

```

It seems that the template with order 1 is only apply ? ☹

Could you help me please 😉 An idea where is my mistake ?

Thanks

---

<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:** [May 26, 2023, 12:55pm UTC](https://discuss.elastic.co/t/index-template-exclude-index-seems-not-working/331060/2 "2023-05-26T12:55:05Z")

</div>

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