# Can I replace a dead primary shard with the ok-replica?

**URL:** <https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174>\
**Category:** Elasticsearch\
**Created:** [February 3, 2022, 10:21am UTC](https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174 "2022-02-03T10:21:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [February 3, 2022, 10:21am UTC](https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174/1 "2022-02-03T10:21:04Z")

</div>

I had a situation last night where a node left the cluster and I lost some primary shards. It rejoined, and the shards are showing up as UNASSIGNED with no documents:

```auto
  {
    "index": "my-index",
    "shard": "0",
    "prirep": "p",
    "state": "UNASSIGNED",
    "docs": null,
    "store": null,
    "ip": null,
    "node": null
  },

```

The replicas all look ok. I'm confident with the data in the replica shards. Can I replace the primaries with copies of the replica shards?

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [February 3, 2022, 12:25pm UTC](https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174/2 "2022-02-03T12:25:43Z")

</div>

If replica shard is in the cluster, elaticsearch will assign the shard as primary in a while. So there is no need to replace by youself. What `GET /my-index/_recovery` shows?

---

<div class="post-metadata">

**Author:** ![ndtreviv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ndtreviv/32/22494_2.png) [@ndtreviv](https://discuss.elastic.co/u/ndtreviv)\
**Post date:** [February 3, 2022, 3:16pm UTC](https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174/3 "2022-02-03T15:16:50Z")

</div>

It had been going on for hours overnight, so I'm assuming that recovery couldn't help. I ended up deleting the indexes this morning. Thanks, though! I'll check that endpoint if it happens again and see why the replacement doesn't happen.

---

<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:** [March 3, 2022, 3:17pm UTC](https://discuss.elastic.co/t/can-i-replace-a-dead-primary-shard-with-the-ok-replica/296174/4 "2022-03-03T15:17:27Z")

</div>

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