# Unassigned shards =\> How to set default replica number to 0?

**URL:** https://discuss.elastic.co/t/unassigned-shards-how-to-set-default-replica-number-to-0/336458
**Category:** Elasticsearch
**Created:** [June 20, 2023, 9:21am UTC](https://discuss.elastic.co/t/unassigned-shards-how-to-set-default-replica-number-to-0/336458 "2023-06-20T09:21:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sbocquet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sbocquet/32/105594_2.png) [@sbocquet](https://discuss.elastic.co/u/sbocquet)
#### Post date: [June 20, 2023, 9:21am UTC](https://discuss.elastic.co/t/unassigned-shards-how-to-set-default-replica-number-to-0/336458/1 "2023-06-20T09:21:52Z")

</div>

Hi,

A few days ago, I've just installed a new node to my single node cluster, in order to manage datastreams lifecycle policies between 2 nodes :

- elk1 is configured in elasticsearch.yml with  
`node.roles: master, data_content, data_hot`
- elk2 is configured in elasticsearch.yml with  
`node.roles: data_warm, data_cold, data_frozen`

There is no replica node in the cluster.

Since, I have some 'unassigned shards' created each time a datastream need to create a new indice.

```auto
GET _cluster/allocation/explain
{
  "index": ".ds-logs-security-default-2023.06.20-000004", 
  "shard": 0, 
  "primary": false 
}

```

```auto
{
  "index": ".ds-logs-security-default-2023.06.20-000004",
  "shard": 0,
  "primary": false,
  "current_state": "unassigned",
  "unassigned_info": {
    "reason": "INDEX_CREATED",
    "at": "2023-06-20T01:06:45.736Z",
    "last_allocation_status": "no_attempt"
  },
  "can_allocate": "no",
  "allocate_explanation": "Elasticsearch isn't allowed to allocate this shard to any of the nodes in the cluster. Choose a node to which you expect this shard to be allocated, find this node in the node-by-node explanation, and address the reasons which prevent Elasticsearch from allocating this shard there.",
  "node_allocation_decisions": [
    {
      "node_id": "QkN3guLiS5qMZBzZpMsBoA",
      "node_name": "elkglbvprd2",
      "transport_address": "172.18.0.219:9300",
      "node_attributes": {
        "xpack.installed": "true"
      },
      "node_decision": "no",
      "weight_ranking": 1,
      "deciders": [
        {
          "decider": "data_tier",
          "decision": "NO",
          "explanation": "index has a preference for tiers [data_hot] and node does not meet the required [data_hot] tier"
        }
      ]
    },
    {
      "node_id": "AjJt4OmLSdWLuCzGPK_bpQ",
      "node_name": "elkglbvprd1",
      "transport_address": "172.18.0.218:9300",
      "node_attributes": {
        "xpack.installed": "true"
      },
      "node_decision": "no",
      "weight_ranking": 2,
      "deciders": [
        {
          "decider": "same_shard",
          "decision": "NO",
          "explanation": "a copy of this shard is already allocated to this node [[.ds-logs-security-default-2023.06.20-000004][0], node[AjJt4OmLSdWLuCzGPK_bpQ], [P], s[STARTED], a[id=HALmKeVyTni1ON1M56IG-g], failed_attempts[0]]"
        }
      ]
    }
  ]
}

```

What I understand is that the new indice is created on node elk1 but cannot be created on node elk2 because this node doesn't have [data\_hot].  
I think it's because the new indice is created with a default replica count of 1, as when I set the number of replica too 0, error is diseappering.

So, is there a way to configure datastreams to have 0 in number of replica to avoid this error each time a new indice is created for the existing datastream?

Plus, is there a way to have this configured by default to all new datastreams ?

Regards.

---

<div class="post-metadata">

### Author: ![sbocquet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sbocquet/32/105594_2.png) [@sbocquet](https://discuss.elastic.co/u/sbocquet)
#### Post date: [June 20, 2023, 1:36pm UTC](https://discuss.elastic.co/t/unassigned-shards-how-to-set-default-replica-number-to-0/336458/2 "2023-06-20T13:36:37Z")

</div>

I have modified my template in the same way of this post (adding number\_of\_replicas : 0 in it)

> [@Elasticsearch 8 single node replicas 0](https://discuss.elastic.co/t/elasticsearch-8-single-node-replicas-0/299676/8):
>
> 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]

Will see if it works in a few days...

---

<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: [July 18, 2023, 1:37pm UTC](https://discuss.elastic.co/t/unassigned-shards-how-to-set-default-replica-number-to-0/336458/3 "2023-07-18T13:37:38Z")

</div>

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