Is it possible to set default number of replicas in elasticsearch

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 ?

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

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

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

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

1 Like

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