# \[ES5.6\] Unassigned Shards due to DANGLING\_INDEX\_IMPORTED

**URL:** https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739
**Category:** Elasticsearch
**Created:** [October 22, 2019, 11:04pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739 "2019-10-22T23:04:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![UDixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/udixit/32/53219_2.png) [@UDixit](https://discuss.elastic.co/u/UDixit)
#### Post date: [October 22, 2019, 11:04pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/1 "2019-10-22T23:04:02Z")

</div>

We are seeing multiple cases where an index was deleted \> 1 month ago but after a node restart the shards of this index becomes unassigned due to DANGLING\_INDEX\_IMPORTED.

Actually, the corresponding index `uuuid` folder isn't getting deleted from a node's data directory.

I have the following questions:

1. How can I ensure that the index folder is deleted from each of the cluster nodes after an index has been deleted.
2. Is there an ES recommended way for deleting indices?
3. Can this happen because an index was not closed before deleting it?
4. How can I prevent this from happening again?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [October 23, 2019, 5:22am UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/2 "2019-10-23T05:22:33Z")

</div>

One thing I believe can cause this is if your cluster is not correctly configured and can suffer from split-brain scenarios. Please make sure you have followed [these guidelines](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/modules-node.html#split-brain) as this otherwise can/will lead to data loss.

> [@UDixit](#):
>
> How can I ensure that the index folder is deleted from each of the cluster nodes after an index has been deleted.

This should be automatic in a correctly configured cluster.

> [@UDixit](#):
>
> Is there an ES recommended way for deleting indices?

Always use the APIs.

> [@UDixit](#):
>
> Can this happen because an index was not closed before deleting it?

No.

---

<div class="post-metadata">

### Author: ![UDixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/udixit/32/53219_2.png) [@UDixit](https://discuss.elastic.co/u/UDixit)
#### Post date: [October 29, 2019, 6:51pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/3 "2019-10-29T18:51:59Z")

</div>

In our current setup, all nodes are dataNodes as well as master eligible.  
We've set min\_master\_nodes to n/2+1 and have our own custom algo to ensure split-brain never occurs.  
Is there a way to disable import of dangling indexes?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [October 29, 2019, 7:00pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/4 "2019-10-29T19:00:38Z")

</div>

> [@UDixit](#):
>
> We've set min\_master\_nodes to n/2+1 and have our own custom algo to ensure split-brain never occurs.

Can you provide some additional details on this?

---

<div class="post-metadata">

### Author: ![UDixit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/udixit/32/53219_2.png) [@UDixit](https://discuss.elastic.co/u/UDixit)
#### Post date: [October 29, 2019, 7:02pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/5 "2019-10-29T19:02:44Z")

</div>

I'm not sure if I can disclose the details. Apologies!

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [October 29, 2019, 7:30pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/6 "2019-10-29T19:30:04Z")

</div>

I am not entirely sure there are no other causes, but the fact that you end up with dangling indicxes in a running cluster could indicate that your custom algorithm is not working properly under all conditions and failure scenarios...

Why are you not using the default algorithm?

---

<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: [November 26, 2019, 7:30pm UTC](https://discuss.elastic.co/t/es5-6-unassigned-shards-due-to-dangling-index-imported/204739/7 "2019-11-26T19:30:06Z")

</div>

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