# Set number of replicas to 0 for all indices and index templates

**URL:** https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078
**Category:** Elastic Observability
**Created:** [January 15, 2024, 2:51pm UTC](https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078 "2024-01-15T14:51:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![georgms](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgms/32/124425_2.png) [@georgms](https://discuss.elastic.co/u/georgms)
#### Post date: [January 15, 2024, 2:51pm UTC](https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078/1 "2024-01-15T14:51:44Z")

</div>

We're running an Elastic Cloud APM setup for a small application. As this is not critical data we're deliberately using only a single zone across all tier. We are aware of the potential consequences of downtime or data loss.

However, all index templates, and thus all indices, have `settings.index.number_of_replicas = 1` by default so the health status has lots of `This cluster has X unavailable replica shards.` warnings. I understand where the warning is coming from (we have only one zone so Elastic can't distribute the replicas) but we deliberately only want one zone so I want to get rid of this warning.

I'm now going through all indices and index templates to manually configure `settings.index.number_of_replicas = 0`. However, when we set up a new APM integration this might create a new index template with `number_of_replicas = 1` and then I'm starting all over again.

I'm not sure anymore but we might have started out the deployment with two zones and then scaled down to one zone so this _might_ be an artifact of that situation.

How can I configure the APM instance so that all new index templates by default have `number_of_replicas = 0`?

---

<div class="post-metadata">

### Author: ![georgms](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgms/32/124425_2.png) [@georgms](https://discuss.elastic.co/u/georgms)
#### Post date: [January 15, 2024, 2:58pm UTC](https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078/2 "2024-01-15T14:58:10Z")

</div>

Related: How can I suppress the `Your deployment and data could become unavailable` health warning?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a1087babe5ec7432bd27c1f56c5cd06a6b9e2aa.png)

Again, we are aware of the consequences but acknowledging that, I want my health to be green.

---

<div class="post-metadata">

### Author: ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)
#### Post date: [January 17, 2024, 11:09am UTC](https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078/3 "2024-01-17T11:09:49Z")

</div>

> [@georgms](#):
>
> We're running an Elastic Cloud APM setup for a small application. As this is not critical data we're deliberately using only a single zone across all tier. We are aware of the potential consequences of downtime or data loss.
> 
> However, all index templates, and thus all indices, have `settings.index.number_of_replicas = 1` by default so the health status has lots of `This cluster has X unavailable replica shards.` warnings. I understand where the warning is coming from (we have only one zone so Elastic can't distribute the replicas) but we deliberately only want one zone so I want to get rid of this warning.
> 
> I'm now going through all indices and index templates to manually configure `settings.index.number_of_replicas = 0`. However, when we set up a new APM integration this might create a new index template with `number_of_replicas = 1` and then I'm starting all over again.
> 
> I'm not sure anymore but we might have started out the deployment with two zones and then scaled down to one zone so this _might_ be an artifact of that situation.
> 
> How can I configure the APM instance so that all new index templates by default have `number_of_replicas = 0`?

Hi,

You can set the number of replicas in the APM Server configuration file (apm-server.yml) using the `setup.template.settings.index.number_of_replicas` setting

> **[Configure Elasticsearch index template loading | APM User Guide \[7.17\] | Elastic](https://www.elastic.co/guide/en/apm/guide/7.17/configuration-template.html)**

Regards

---

<div class="post-metadata">

### Author: ![georgms](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/georgms/32/124425_2.png) [@georgms](https://discuss.elastic.co/u/georgms)
#### Post date: [January 18, 2024, 9:53am UTC](https://discuss.elastic.co/t/set-number-of-replicas-to-0-for-all-indices-and-index-templates/351078/4 "2024-01-18T09:53:46Z")

</div>

Thanks @yago82! Is this applicable for Elastic Cloud as well, or just when self-hosting? Where would I edit the `apm-server.yml` in Elastic Cloud?
