# Is it possible to set default number of replicas in elasticsearch

**URL:** https://discuss.elastic.co/t/is-it-possible-to-set-default-number-of-replicas-in-elasticsearch/281215
**Category:** Elasticsearch
**Created:** [August 12, 2021, 2:21pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-default-number-of-replicas-in-elasticsearch/281215 "2021-08-12T14:21:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)
#### Post date: [August 12, 2021, 2:21pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-default-number-of-replicas-in-elasticsearch/281215/1 "2021-08-12T14:21:47Z")

</div>

hello,

Mine is a single node set up , and hence no replicas are assigned (i think ?) . Is it possible to set default replica number as 0 in elasticsearch.yml ?

```auto
GET /_cat/allocation?v

shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
    29 6.9gb 10.2gb 38.7gb 48.9gb 20 nexus-dev01.test.com 172.26.207.164 Nexus-dev01
    13 UNASSIGNED

```

The reason seems to be this

```auto
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason

.kibana_7.13.2_001 0 p STARTED    
logstash-ghostmon-000009 0 p STARTED    
logstash-ghostmon-000009 0 r UNASSIGNED INDEX_CREATED
.async-search 0 p STARTED    
.apm-agent-configuration 0 p STARTED    
.security-7 0 p STARTED    
.kibana-event-log-7.13.2-000002 0 p STARTED    
logstash-ghostmon-000008 0 p STARTED    
logstash-ghostmon-000008 0 r UNASSIGNED INDEX_CREATED
logstash_viz1 0 p STARTED    
logstash_viz1 0 r UNASSIGNED CLUSTER_RECOVERED
logstash-ghostmon-000006 0 p STARTED    
logstash-ghostmon-000006 0 r UNASSIGNED INDEX_CREATED

```

---

<div class="post-metadata">

### Author: ![robertknutzen](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@robertknutzen](https://discuss.elastic.co/u/robertknutzen)
#### Post date: [August 12, 2021, 8:44pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-default-number-of-replicas-in-elasticsearch/281215/2 "2021-08-12T20:44:19Z")

</div>

I haven't run into this problem in quite a while but I also haven't played with a single node in quite a while either.  
I think you should set your discovery type to single node.  
`discovery.type: single-node # configure as single-node cluster`

If you're still having problems you can use an index template and set it to apply to \* (all indices)

you can do that in kibana under management or do this in the console

```auto
PUT _template/no-replicas
{
  "index_patterns": [
    "*"
  ],
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}

```

Then any index you create will default to 1 shard and 0 zero replicas

---

<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 9, 2021, 8:45pm UTC](https://discuss.elastic.co/t/is-it-possible-to-set-default-number-of-replicas-in-elasticsearch/281215/3 "2021-09-09T20:45:03Z")

</div>

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