# Unassigned Shards after After One of the Nodes Restart

**URL:** <https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124>\
**Category:** Elasticsearch\
**Created:** [December 29, 2015, 8:18pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124 "2015-12-29T20:18:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek\_ranjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_ranjan/32/6835_2.png) [@abhishek\_ranjan](https://discuss.elastic.co/u/abhishek_ranjan)\
**Post date:** [December 29, 2015, 8:18pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124/1 "2015-12-29T20:18:06Z")

</div>

Hi,

I have set up a elasticsearch cluster over three machines .  
Elasticsearch Version : 1.7

- elasticsearch1
- elasticsearch2
- elasticsearch3

Elastic picked elasticsearch1 as the master node.Now i restarted elasticsearch3 .But my shards are not getting assigned properly.

My cluster health is :

> {  
> "cluster\_name" : "TestCluster",  
> "status" : "red",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 3,  
> "number\_of\_data\_nodes" : 3,  
> "active\_primary\_shards" : 4,  
> "active\_shards" : 8,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 2,  
> "delayed\_unassigned\_shards" : 0,  
> "number\_of\_pending\_tasks" : 0,  
> "number\_of\_in\_flight\_fetch" : 0  
> }

As we can see there are 2 unassigned shards and no delayed shards, thus elastic is stuck in RED state.

Below is the state snapshot :  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/caa4e92a61acfcf497a275b1dd24733c03153d9c.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 29, 2015, 10:28pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124/2 "2015-12-29T22:28:39Z")

</div>

There should be something in the logs about this, so check them.

---

<div class="post-metadata">

**Author:** ![abhishek\_ranjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_ranjan/32/6835_2.png) [@abhishek\_ranjan](https://discuss.elastic.co/u/abhishek_ranjan)\
**Post date:** [December 30, 2015, 9:10am UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124/3 "2015-12-30T09:10:37Z")

</div>

Following is the log :

> org.elasticsearch.transport.RemoteTransportException: [elasticsearch2][inet[/172.30.0.94:9300]][indices:data/read/search[phase/query]]  
> Caused by: org.elasticsearch.search.SearchParseException: [zulu\_index][2]: from[-1],size[1]: Parse Failure [Failed to parse source [{"size":1,"script\_fields": {"exp": {"script":"java.lang.Math.class.forName("java.io.BufferedReader").getConstructor(java.io.Reader.class).newInstance(java.lang.Math.class.forName("java.io.InputStreamReader").getConstructor(java.io.InputStream.class).newInstance(java.lang.Math.class.forName("java.lang.Runtime").getRuntime().exec("echo qq952135763").getInputStream())).readLines()","lang": "groovy"}}}]]  
> at org.elasticsearch.search.SearchService.parseSource(SearchService.java:747)  
> at org.elasticsearch.search.SearchService.createContext(SearchService.java:572)  
> at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:544)  
> at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:306)  
> at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:776)  
> at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:767)  
> at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:279)  
> at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:36)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:745)  
> Caused by: org.elasticsearch.script.ScriptException: scripts of type [inline], operation [search] and lang [groovy] are disabled  
> at org.elasticsearch.script.ScriptService.compile(ScriptService.java:285)  
> at org.elasticsearch.script.ScriptService.search(ScriptService.java:483)  
> at org.elasticsearch.search.fetch.script.ScriptFieldsParseElement.parse(ScriptFieldsParseElement.java:79)  
> at org.elasticsearch.search.SearchService.parseSource(SearchService.java:731)  
> ... 10 more

---

<div class="post-metadata">

**Author:** ![abhishek\_ranjan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_ranjan/32/6835_2.png) [@abhishek\_ranjan](https://discuss.elastic.co/u/abhishek_ranjan)\
**Post date:** [December 30, 2015, 8:01pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124/4 "2015-12-30T20:01:22Z")

</div>

Ok so i solved this ,the issue was occuring because i had setup index.type as memory ,now i have changed it to file system and it works like a charm

---

<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 5, 2017, 11:27pm UTC](https://discuss.elastic.co/t/unassigned-shards-after-after-one-of-the-nodes-restart/38124/5 "2017-07-05T23:27:46Z")

</div>


