# How to find which shard got corrupt

**URL:** https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387
**Category:** Elasticsearch
**Created:** [August 29, 2013, 8:21am UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387 "2013-08-29T08:21:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)
#### Post date: [August 29, 2013, 8:21am UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/1 "2013-08-29T08:21:16Z")

</div>

Hi

Is there any way to find out which shard got corrupt.

Using elasticsearch cluster state we can determine which shard is  
unassigned. But shards may be in unassigned state when any node is down or  
any shard got corrupted.

I am looking for java api which can be used to find which shard got corrupt.

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)
#### Post date: [August 30, 2013, 3:48am UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/2 "2013-08-30T03:48:00Z")

</div>

shard got corrupt? you mean index corrupt? if so, maybe you want to look  
into index.shard.check\_on\_startup

/Jason

On Thu, Aug 29, 2013 at 4:21 PM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> Hi
> 
> Is there any way to find out which shard got corrupt.
> 
> Using elasticsearch cluster state we can determine which shard is  
> unassigned. But shards may be in unassigned state when any node is down or  
> any shard got corrupted.
> 
> I am looking for java api which can be used to find which shard got  
> corrupt.
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)
#### Post date: [August 30, 2013, 1:16pm UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/3 "2013-08-30T13:16:26Z")

</div>

Thanks for response Jason

Yes, i am looking for way to find corrupted index.  
I set index.shard.check\_on\_startup : true but it is giving same behaviour.

I was asking only one case but now i would like to know:

1. I have seen that Elasticsearch cluster state is GREEN and all shards are  
available even after index's one shard's data got corrupt. When i restart  
my cluster then its status change to RED and that shard goes to UNASSIGNED  
state. With and without setting index.shard.check\_on\_startup : true i am  
getting same behaviour. How to find which index got corrupt _without any  
downtime_ ?
2. Shards goes to UNASSIGNED state when they are not available. This may be  
due to (a) shard got corrupt (b) ES node is down. Then how to determine  
that shard's data got corrupt?

On Fri, Aug 30, 2013 at 9:18 AM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:

> shard got corrupt? you mean index corrupt? if so, maybe you want to look  
> into index.shard.check\_on\_startup
> 
> /Jason
> 
> On Thu, Aug 29, 2013 at 4:21 PM, Hanish Bansal \<  
> [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> 
> > Hi
> > 
> > Is there any way to find out which shard got corrupt.
> > 
> > Using elasticsearch cluster state we can determine which shard is  
> > unassigned. But shards may be in unassigned state when any node is down or  
> > any shard got corrupted.
> > 
> > I am looking for java api which can be used to find which shard got  
> > corrupt.
> > 
> > --  
> > _Thanks & Regards_  
> > _Hanish Bansal_
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)
#### Post date: [August 31, 2013, 11:31am UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/4 "2013-08-31T11:31:54Z")

</div>

When you set the config to true, it should check the index during startup.  
You can turn on necessary logs on java classes to see the process... but if  
I am not mistaken, you can also set the config to fix so that if it  
encounter index corruption, it will fix the corrupted index. If you have  
replication of your shard, you should have able to bring down one node to  
do maintenance , in your case, find which index is corrupt. there is a  
lucene class that does index check,  
[http://java.dzone.com/news/lucene-and-solrs-checkindex](http://java.dzone.com/news/lucene-and-solrs-checkindex) . Maybe someone that  
has experience in elasticsearch can comment / advice more on the index  
check in es?

When a node goes down, the cluster should been able to reallocate the  
unassigned shard to another node?

Jason

On Fri, Aug 30, 2013 at 9:16 PM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> Thanks for response Jason
> 
> Yes, i am looking for way to find corrupted index.  
> I set index.shard.check\_on\_startup : true but it is giving same behaviour.
> 
> I was asking only one case but now i would like to know:
> 
> 1. I have seen that Elasticsearch cluster state is GREEN and all shards  
> are available even after index's one shard's data got corrupt. When i  
> restart my cluster then its status change to RED and that shard goes to  
> UNASSIGNED state. With and without setting index.shard.check\_on\_startup :  
> true i am getting same behaviour. How to find which index got corrupt _without  
> any downtime_ ?
> 2. Shards goes to UNASSIGNED state when they are not available. This may  
> be due to (a) shard got corrupt (b) ES node is down. Then how to determine  
> that shard's data got corrupt?
> 
> On Fri, Aug 30, 2013 at 9:18 AM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> 
> > shard got corrupt? you mean index corrupt? if so, maybe you want to look  
> > into index.shard.check\_on\_startup
> > 
> > /Jason
> > 
> > On Thu, Aug 29, 2013 at 4:21 PM, Hanish Bansal \<  
> > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > 
> > > Hi
> > > 
> > > Is there any way to find out which shard got corrupt.
> > > 
> > > Using elasticsearch cluster state we can determine which shard is  
> > > unassigned. But shards may be in unassigned state when any node is down or  
> > > any shard got corrupted.
> > > 
> > > I am looking for java api which can be used to find which shard got  
> > > corrupt.
> > > 
> > > --  
> > > _Thanks & Regards_  
> > > _Hanish Bansal_
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [August 31, 2013, 7:32pm UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/5 "2013-08-31T19:32:06Z")

</div>

The shards are numbered, in the log messages you can find out what shard  
number is corrupt. In the cluster state info, you can lookup the node of  
this shard number. On the node, you can find the shard data in the data  
path.

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:18am UTC](https://discuss.elastic.co/t/how-to-find-which-shard-got-corrupt/13387/6 "2017-07-06T02:18:38Z")

</div>


