# Elasticsearch 8 single node replicas 0

**URL:** https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676
**Category:** Elasticsearch
**Created:** [March 15, 2022, 2:50am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676 "2022-03-15T02:50:31Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![VamPikmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vampikmin/32/22367_2.png) [@VamPikmin](https://discuss.elastic.co/u/VamPikmin)
#### Post date: [March 15, 2022, 2:50am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/1 "2022-03-15T02:50:31Z")

</div>

I have a single node cluster which is showing yellow because replicas are set to 1

Is there a way to get this setup so that all future indexes have replicas set to 0

This used to be easy with legacy templates

```auto
curl -XPUT localhost:9200/_template/default -d '{"index_patterns": ["*"], "order": "1", "settings": {"number_of_shards": "1","number_of_replicas": "0"}}' -H 'Content-Type: application/json'

```

Appreciate the help

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2c66dcfaee35506d6871044ba30ae222217713cf.png)

---

<div class="post-metadata">

### Author: ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)
#### Post date: [March 15, 2022, 7:20am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/2 "2022-03-15T07:20:32Z")

</div>

Is that okay?

```auto
PUT /_index_template/replicas
{
  "index_patterns" : ["*"],
  "template": {
    "settings" : {
      "number_of_replicas" : 0
    }
  }
}

```

> **[Create or update index template API | Elasticsearch Guide \[8.1\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/indices-put-template.html)**

---

<div class="post-metadata">

### Author: ![VamPikmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vampikmin/32/22367_2.png) [@VamPikmin](https://discuss.elastic.co/u/VamPikmin)
#### Post date: [March 16, 2022, 6:06am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/3 "2022-03-16T06:06:08Z")

</div>

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/_index_template/replicas -d '{"index_patterns": ["*"], "template": {"settings": {"number_of_replicas": "0"}}}' -H 'Content-Type: application/json'

```

Gives the following error, maybe I need to change priority to something higher

`{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"index template [replicas] has index patterns [*] matching patterns from existing templates [.kibana-event-log-8.1.0-template,.kibana_security_session_index_template_1,.monitoring-beats-mb,.monitoring-ent-search-mb,.monitoring-es-mb,.monitoring-kibana-mb,.monitoring-logstash-mb] with patterns (.kibana-event-log-8.1.0-template => [.kibana-event-log-8.1.0-*],.kibana_security_session_index_template_1 => [.kibana_security_session_1],.monitoring-beats-mb => [.monitoring-beats-8-*],.monitoring-ent-search-mb => [.monitoring-ent-search-8-*],.monitoring-es-mb => [.monitoring-es-8-*],.monitoring-kibana-mb => [.monitoring-kibana-8-*],.monitoring-logstash-mb => [.monitoring-logstash-8-*]) that have the same priority [0], multiple index templates may not match during index creation, please use a different priority"}],"type":"illegal_argument_exception","reason":"index template [replicas] has index patterns [*] matching patterns from existing templates [.kibana-event-log-8.1.0-template,.kibana_security_session_index_template_1,.monitoring-beats-mb,.monitoring-ent-search-mb,.monitoring-es-mb,.monitoring-kibana-mb,.monitoring-logstash-mb] with patterns (.kibana-event-log-8.1.0-template => [.kibana-event-log-8.1.0-*],.kibana_security_session_index_template_1 => [.kibana_security_session_1],.monitoring-beats-mb => [.monitoring-beats-8-*],.monitoring-ent-search-mb => [.monitoring-ent-search-8-*],.monitoring-es-mb => [.monitoring-es-8-*],.monitoring-kibana-mb => [.monitoring-kibana-8-*],.monitoring-logstash-mb => [.monitoring-logstash-8-*]) that have the same priority [0], multiple index templates may not match during index creation, please use a different priority"},"status":400}`

I can change the existing settings with this command, but when 8.2.0 comes out I have a feeling the new indexes and or streams will have the default replica of 1

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/*/_settings?pretty -H 'Content-Type: application/json' -d '{"settings": {"number_of_replicas": 0}}'
{
  "acknowledged" : true
}

```

---

<div class="post-metadata">

### Author: ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)
#### Post date: [March 16, 2022, 6:23am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/4 "2022-03-16T06:23:23Z")

</div>

As you said, you can use `priority ` to set template priority

---

<div class="post-metadata">

### Author: ![VamPikmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vampikmin/32/22367_2.png) [@VamPikmin](https://discuss.elastic.co/u/VamPikmin)
#### Post date: [March 16, 2022, 10:05am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/5 "2022-03-16T10:05:55Z")

</div>

Still need to find out what this means, I'd like to keep things "default" apart from the replica number

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/_index_template/replicas -d '{"index_patterns": ["*"], "template": {"settings": {"number_of_replicas": "0"}},"priority": 7}' -H 'Content-Type: application/json'

```

> {"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"composable template [replicas] with index patterns [_], priority [7] and no data stream configuration would cause data streams [.monitoring-es-8-mb] to no longer match a data stream template"}],"type":"illegal\_argument\_exception","reason":"composable template [replicas] with index patterns [_], priority [7] and no data stream configuration would cause data streams [.monitoring-es-8-mb] to no longer match a data stream template"},"status":400}

---

<div class="post-metadata">

### Author: ![KillianS](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@KillianS](https://discuss.elastic.co/u/KillianS)
#### Post date: [March 25, 2022, 8:16am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/6 "2022-03-25T08:16:39Z")

</div>

Hi all,

I have the same problem, I have a single node with 0 replica and since ELK 8.0 all of my indexes are in yellow state. I follow this fix to resolve the problem and he work except for data streams. [Setting index.number\_of\_replicas =\> 0 by default in ES \>= 5](https://discuss.elastic.co/t/setting-index-number-of-replicas-0-by-default-in-es-5/138195). I manually index data streams to recover a green state. Any help would be appreciate to auto indexing the data streams.

Thanks.

---

<div class="post-metadata">

### Author: ![VamPikmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vampikmin/32/22367_2.png) [@VamPikmin](https://discuss.elastic.co/u/VamPikmin)
#### Post date: [March 25, 2022, 10:16am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/7 "2022-03-25T10:16:38Z")

</div>

Can I ask you to elaborate on manually indexing data streams?  
Replicas are just copies of shards so if they are discarded it doesn't matter (in a single node cluster)  
This command goes through the existing indices and changes them to green

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/*/_settings?pretty -H 'Content-Type: application/json' -d '{"settings": {"number_of_replicas": 0}}'

```

Today I created a template with a high priority that stuck

```auto
curl -XGET -k -u elastic:$pass https://localhost:9200/_index_template/default?pretty
{
  "index_templates" : [
    {
      "name" : "default",
      "index_template" : {
        "index_patterns" : [
          "*"
        ],
        "template" : {
          "settings" : {
            "index" : {
              "number_of_replicas" : "0"
            }
          }
        },
        "composed_of" : [],
        "priority" : 90000000,
        "_meta" : {
          "description" : "this used to be easy"
        },
        "data_stream" : {
          "hidden" : false,
          "allow_custom_routing" : false
        }
      }
    }
  ]
}

```

It seems I can't delete it anymore as it's in use now heh

```auto
curl -XDELETE -k -u elastic:$pass https://localhost:9200/_index_template/default?pretty
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "unable to remove composable templates [default] as they are in use by a data streams [.monitoring-es-8-mb, logs-elastic_agent-default, logs-elastic_agent.filebeat-default, logs-elastic_agent.fleet_server-default, logs-elastic_agent.metricbeat-default, logs-system.application-default, logs-system.auth-default, logs-system.security-default, logs-system.syslog-default, logs-system.system-default, metricbeat-8.1.0, metricbeat-8.1.1, metrics-elastic_agent.elastic_agent-default, metrics-elastic_agent.filebeat-default, metrics-elastic_agent.fleet_server-default, metrics-elastic_agent.metricbeat-default, metrics-system.cpu-default, metrics-system.diskio-default, metrics-system.filesystem-default, metrics-system.fsstat-default, metrics-system.load-default, metrics-system.memory-default, metrics-system.network-default, metrics-system.process-default, metrics-system.process.summary-default, metrics-system.socket_summary-default, metrics-system.uptime-default]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "unable to remove composable templates [default] as they are in use by a data streams [.monitoring-es-8-mb, logs-elastic_agent-default, logs-elastic_agent.filebeat-default, logs-elastic_agent.fleet_server-default, logs-elastic_agent.metricbeat-default, logs-system.application-default, logs-system.auth-default, logs-system.security-default, logs-system.syslog-default, logs-system.system-default, metricbeat-8.1.0, metricbeat-8.1.1, metrics-elastic_agent.elastic_agent-default, metrics-elastic_agent.filebeat-default, metrics-elastic_agent.fleet_server-default, metrics-elastic_agent.metricbeat-default, metrics-system.cpu-default, metrics-system.diskio-default, metrics-system.filesystem-default, metrics-system.fsstat-default, metrics-system.load-default, metrics-system.memory-default, metrics-system.network-default, metrics-system.process-default, metrics-system.process.summary-default, metrics-system.socket_summary-default, metrics-system.uptime-default]"
  },
  "status" : 400
}

```

It looks promising but I need to find out how to actually delete it  
that's for another day...  
([Index Template cannot be deleted / error message seems incorrect · Issue #84171 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/84171))

---

<div class="post-metadata">

### Author: ![KillianS](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@KillianS](https://discuss.elastic.co/u/KillianS)
#### Post date: [March 25, 2022, 11:02am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/8 "2022-03-25T11:02:53Z")

</div>

I just tried another thing. In the Kibana Web interface I edit the template of index who not auto indexing. I just add a line with the setting "number\_of\_replicas": "0". I tell you in few days if this work.

![monitoring-es-mb](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d658c85e4343bb83b9653e83b5432fac13c0fc7.png)

---

<div class="post-metadata">

### Author: ![VamPikmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vampikmin/32/22367_2.png) [@VamPikmin](https://discuss.elastic.co/u/VamPikmin)
#### Post date: [March 25, 2022, 10:39pm UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/9 "2022-03-25T22:39:12Z")

</div>

Nice work, I've been playing with those too- in Component Templates I do a search for settings and changed them all

With my setup I've had issues with filebeat creating a new index with every upgrade with replica of 1 (filebeat-8.0.0, filebeat-8.0.1,etc)

I've realized last night these come from the filebeat.yml so I specifically added replicas zero there  
I can't really test unless I delete the data 😕 or wait until next release 🙂

```auto
# ======================= Elasticsearch template setting =======================
setup.template.settings:
  index.number_of_shards: 1
  index.number_of_replicas: 0

```

Setting up a default with the following settings didn't work for filebeat possible because I haven't made the above change, even though default template is getting picked up

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/_index_template/default -d '{"index_patterns":["*"],"template":{"settings":{"index":{"number_of_replicas":"0"}}},"composed_of":[],"priority":90000000,"_meta":{"description":"b7-default"},"data_stream":{"hidden":false,"allow_custom_routing":false}}}' -H 'Content-Type: application/json'

```

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f18b34878050f53f2adccb661d180bd0a3d94420.png)

I tried to delete the template I made by changing the default template from \* to something not existent as was suggested in the previous post (github link) but I was unable to because .fleet-actions-results doesn't have a template, so I had to create it with a priority of 90000001

In any case I don't recommend doing any of this, everything I read so far suggests that setting up a template with \* is a bad thing, and looks like setting it up with \* and negating the . (to not include hidden indices in the template is not working, there's a github issue open for that.  
It would be so much simpler if there was something in Elasticsearch.yml to set replica settings globally 😃 and not have to worry about it

```auto
curl -XPUT -k -u elastic:$pass https://localhost:9200/_index_template/default -d '{"index_patterns":["whatever"],"template":{"settings":{"index":{"number_of_replicas":"0"}}},"composed_of":[],"priority":90000000,"_meta":{"description":"b7"},"data_stream":{"hidden":false,"allow_custom_routing":false}}}' -H 'Content-Type: application/json'
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"composable template [default] with index patterns [b7], priority [90000000] would cause data streams [.fleet-actions-results] to no longer match a data stream template"}],"type":"illegal_argument_exception","reason":"composable template [default] with index patterns [b7], priority [90000000] would cause data streams [.fleet-actions-results] to no longer match a data stream template"},"status":400}

```

---

<div class="post-metadata">

### Author: ![KillianS](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@KillianS](https://discuss.elastic.co/u/KillianS)
#### Post date: [March 28, 2022, 6:45am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/10 "2022-03-28T06:45:26Z")

</div>

Hi,

I have check this morning in the Web interface of Kibana and all of my index are in green state, data streams too so it seems modify the template in the Web interface fix the issue.

---

<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: [April 25, 2022, 6:46am UTC](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/11 "2022-04-25T06:46:01Z")

</div>

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