# Template priority explanation

**URL:** <https://discuss.elastic.co/t/template-priority-explanation/311443>\
**Category:** Elasticsearch\
**Created:** [August 4, 2022, 2:51pm UTC](https://discuss.elastic.co/t/template-priority-explanation/311443 "2022-08-04T14:51:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pestevao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pestevao/32/44138_2.png) [@pestevao](https://discuss.elastic.co/u/pestevao)\
**Post date:** [August 4, 2022, 2:51pm UTC](https://discuss.elastic.co/t/template-priority-explanation/311443/1 "2022-08-04T14:51:58Z")

</div>

Hi all,

I'm trying to change the number\_of\_replicas of some indexes, applying a loosely index\_patterns but... I'm struggling with priority.

If I make a change on number\_of\_replicas and define a priority 1 on my new template and some other template with priority 3 applies to the same index but lacks the number\_of\_replicas definition, it will be applied?

So my template:

```auto
{
  "priority": 1,
  "index_patterns": [
    "xpto*"
  ],
  "template": {
    "aliases": {},
    "settings": {
      "index": {
        "number_of_replicas": 0
      }
    }
  }
}

```

The other template

```auto
{
  "priority": 3,
  "index_patterns": [
    "xpto*"
  ],
  "template": {
    "aliases": {},
    "mappings": {
      ...
    }
  }
}

```

If it will not apply the number\_of\_replicas how can I make it to work without change the highest priority template?

Thank you, Pedro

---

<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:** [August 16, 2022, 12:41am UTC](https://discuss.elastic.co/t/template-priority-explanation/311443/2 "2022-08-16T00:41:02Z")

</div>

> [@pestevao](#):
>
> If I make a change on number\_of\_replicas and define a priority 1 on my new template and some other template with priority 3 applies to the same index but lacks the number\_of\_replicas definition, it will be applied?

Priority means that anything that is defined in both settings is only taken from the highest priority.

So if you are not setting the replicas in the higher priority, it will inherit that from the lower priority one.

---

<div class="post-metadata">

**Author:** ![pestevao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pestevao/32/44138_2.png) [@pestevao](https://discuss.elastic.co/u/pestevao)\
**Post date:** [August 17, 2022, 9:06pm UTC](https://discuss.elastic.co/t/template-priority-explanation/311443/3 "2022-08-17T21:06:37Z")

</div>

Thank you @warkolm.

I try:

1. the **replica definition** was on the **lowest template priority** and the **mappings** on the **biggest template priority**. No good:  
The **mappings definitions** were **keepted** but **replicas** on the **default value** (2).

2. the **replica definition** was on the **biggest template priority** and the **mappings** on the **lowest template priority**. No good too:  
The **mappings definitions** were **ignored** and **replicas** definition were **ok** (0).

Can't keep both definitions to be applied despite the change of priorities in the testing.

The final expectation would be: keep the default template (system / kibana) untouched and re-define the replicas value with a biggest priority template "human made" and not loosing or overwrite anything defined in the default template, namely and in the case, the mappings.

Pedro

---

<div class="post-metadata">

**Author:** ![pestevao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pestevao/32/44138_2.png) [@pestevao](https://discuss.elastic.co/u/pestevao)\
**Post date:** [September 1, 2022, 11:11am UTC](https://discuss.elastic.co/t/template-priority-explanation/311443/4 "2022-09-01T11:11:10Z")

</div>

Hello, nothing more to try?

---

<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:** [September 29, 2022, 11:11am UTC](https://discuss.elastic.co/t/template-priority-explanation/311443/5 "2022-09-29T11:11:24Z")

</div>

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