# Unassigned shards after node close

**URL:** <https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332>\
**Category:** Elasticsearch\
**Created:** [April 14, 2012, 10:17pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332 "2012-04-14T22:17:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![android](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@android](https://discuss.elastic.co/u/android)\
**Post date:** [April 14, 2012, 10:17pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/1 "2012-04-14T22:17:20Z")

</div>

I have 6 indices, running 3 clusters. each index has 1 shard. there are total of 10k documents, and total of 20mb.

I index those documents using JAVA API in a process, and during indexing and querying everything works fine. But if I terminate that process after all the indexing and searching is done, some nodes go unassigned and cluster health goes red.  
If I let the process keep up and running, nodes are all assigned and cluster health is green.

What could be the reason for that?

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [April 14, 2012, 10:22pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/2 "2012-04-14T22:22:31Z")

</div>

Hi,

It seems like you are creating a new node with the Java API and then after  
you close that node (terminate the process) your cluster can't locate the  
shards. Could you please try initializing Elasticsearch client by using:

Node node = nodeBuilder().client(true).node();

Or you can also use the TransportClient.

--  
Regards,  
Rafał Kuć  
Sematext :: [http://sematext.com/](http://sematext.com/)

W dniu niedziela, 15 kwietnia 2012 00:17:20 UTC+2 użytkownik Orcun Simsek  
napisał:

> I have 6 indices, running 3 clusters. each index has 1 shard. there are  
> total  
> of 10k documents, and total of 20mb.
> 
> I index those documents using JAVA API in a process, and during indexing  
> and  
> querying everything works fine. But if I terminate that process after all  
> the indexing and searching is done, some nodes go unassigned and cluster  
> health goes red.  
> If I let the process keep up and running, nodes are all assigned and  
> cluster  
> health is green.
> 
> What could be the reason for that?
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/unassigned-shards-after-node-close-tp3910996p3910996.html](http://elasticsearch-users.115913.n3.nabble.com/unassigned-shards-after-node-close-tp3910996p3910996.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![android](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@android](https://discuss.elastic.co/u/android)\
**Post date:** [April 14, 2012, 11:57pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/3 "2012-04-14T23:57:39Z")

</div>

Initializing with client set to true worked! Thanks!

---

<div class="post-metadata">

**Author:** ![android](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@android](https://discuss.elastic.co/u/android)\
**Post date:** [April 15, 2012, 3:40pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/4 "2012-04-15T15:40:17Z")

</div>

Now, if i set the node using client = true, i get failed to find analyzer exception in an analyze, which is not being thrown if i dont set client true.

> <https://gist.github.com/ortschun/2393383>

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 17, 2012, 10:32am UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/5 "2012-04-17T10:32:01Z")

</div>

Are you sure the client gets connected to the cluster?

On Sun, Apr 15, 2012 at 6:40 PM, android [orcunsimsek@gmail.com](mailto:orcunsimsek@gmail.com) wrote:

> Now, if i set the node using client = true, i get failed to find analyzer  
> exception in an analyze, which is not being thrown if i dont set client  
> true.
> 
> [builder.java · GitHub](https://gist.github.com/2393383)
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/unassigned-shards-after-node-close-tp3910996p3912124.html](http://elasticsearch-users.115913.n3.nabble.com/unassigned-shards-after-node-close-tp3910996p3912124.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 3:32am UTC](https://discuss.elastic.co/t/unassigned-shards-after-node-close/7332/6 "2017-07-06T03:32:19Z")

</div>

Closed on July 6, 2017, 3:32am UTC


