# Issues while creating an index after updating from 0.15 to 0.16.1

**URL:** <https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499>\
**Category:** Elasticsearch\
**Created:** [May 30, 2011, 4:21pm UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499 "2011-05-30T16:21:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicco/32/3106_2.png) [@nicco](https://discuss.elastic.co/u/nicco)\
**Post date:** [May 30, 2011, 4:21pm UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499/1 "2011-05-30T16:21:01Z")

</div>

I have an utility method that takes care of deleting and recreating  
the index that was working fine with version 0.15.0. Now after  
updating to 0.16.1 i get an exception in the last line:

Caused by:  
org.elasticsearch.cluster.routing.RoutingValidationException: [Index  
[6e737712-8833-4802-b079-698dabf40d19]: Wrong number of shards in  
routing table, missing: [5, 6, 7]]  
at  
org.elasticsearch.cluster.routing.RoutingTable.validateRaiseException(RoutingTable.java:  
89)  
at  
org.elasticsearch.cluster.routing.allocation.ShardsAllocation.reroute(ShardsAllocation.java:  
102)  
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService  
$1.execute(MetaDataCreateIndexService.java:270)  
at org.elasticsearch.cluster.service.InternalClusterService  
$2.run(InternalClusterService.java:175)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:680)

client = new TransportClient().addTransportAddress(new  
InetSocketTransportAddress(hostname, 9300));

// Delete any old index with our name  
try{

client.prepareDelete().setIndex(indexName).execute().actionGet(TIMEOUT);  
} catch (ElasticSearchException ignored) {  
System.out.println(ignored)  
}

// Prepare new index with settings  
Settings settings =  
ImmutableSettings.settingsBuilder().put("index.number\_of\_shards", 8)  
.put("index.number\_of\_replicas", 1).build();

client.admin().indices().prepareUpdateSettings(indexName).setSettings(settings).execute().actionGet(TIMEOUT);

Thanks a lot!

---

<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:** [May 30, 2011, 4:24pm UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499/2 "2011-05-30T16:24:38Z")

</div>

You are updating the index.number\_of\_shards setting for the index, which causes it to fail. In general, you should not do that, but in 0.16, there is no safeguard for that now...

On Monday, May 30, 2011 at 7:21 PM, nicco wrote:

> I have an utility method that takes care of deleting and recreating  
> the index that was working fine with version 0.15.0. Now after  
> updating to 0.16.1 i get an exception in the last line:
> 
> Caused by:  
> org.elasticsearch.cluster.routing.RoutingValidationException: [Index  
> [6e737712-8833-4802-b079-698dabf40d19]: Wrong number of shards in  
> routing table, missing: [5, 6, 7]]  
> at  
> org.elasticsearch.cluster.routing.RoutingTable.validateRaiseException(RoutingTable.java:  
> 89)  
> at  
> org.elasticsearch.cluster.routing.allocation.ShardsAllocation.reroute(ShardsAllocation.java:  
> 102)  
> at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService  
> $1.execute(MetaDataCreateIndexService.java:270)  
> at org.elasticsearch.cluster.service.InternalClusterService  
> $2.run(InternalClusterService.java:175)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:680)
> 
> client = new TransportClient().addTransportAddress(new  
> InetSocketTransportAddress(hostname, 9300));
> 
> // Delete any old index with our name  
> try{
> 
> client.prepareDelete().setIndex(indexName).execute().actionGet(TIMEOUT);  
> } catch (ElasticSearchException ignored) {  
> System.out.println(ignored)  
> }
> 
> // Prepare new index with settings  
> Settings settings =  
> ImmutableSettings.settingsBuilder().put("index.number\_of\_shards", 8)  
> .put("index.number\_of\_replicas", 1).build();
> 
> client.admin().indices().prepareUpdateSettings(indexName).setSettings(settings).execute().actionGet(TIMEOUT);
> 
> Thanks a lot!

---

<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:** [May 30, 2011, 4:37pm UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499/3 "2011-05-30T16:37:09Z")

</div>

ok, pushed a check to now allow to change the number of replicas when updating settings (in 0.16 and master branches). This was a change caused by the feature to allow more settings to be changed in runtime using update settings.

On Monday, May 30, 2011 at 7:24 PM, Shay Banon wrote:

> You are updating the index.number\_of\_shards setting for the index, which causes it to fail. In general, you should not do that, but in 0.16, there is no safeguard for that now...
> 
> On Monday, May 30, 2011 at 7:21 PM, nicco wrote:
> 
> > I have an utility method that takes care of deleting and recreating  
> > the index that was working fine with version 0.15.0. Now after  
> > updating to 0.16.1 i get an exception in the last line:
> > 
> > Caused by:  
> > org.elasticsearch.cluster.routing.RoutingValidationException: [Index  
> > [6e737712-8833-4802-b079-698dabf40d19]: Wrong number of shards in  
> > routing table, missing: [5, 6, 7]]  
> > at  
> > org.elasticsearch.cluster.routing.RoutingTable.validateRaiseException(RoutingTable.java:  
> > 89)  
> > at  
> > org.elasticsearch.cluster.routing.allocation.ShardsAllocation.reroute(ShardsAllocation.java:  
> > 102)  
> > at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService  
> > $1.execute(MetaDataCreateIndexService.java:270)  
> > at org.elasticsearch.cluster.service.InternalClusterService  
> > $2.run(InternalClusterService.java:175)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.runTask(ThreadPoolExecutor.java:886)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:680)
> > 
> > client = new TransportClient().addTransportAddress(new  
> > InetSocketTransportAddress(hostname, 9300));
> > 
> > // Delete any old index with our name  
> > try{
> > 
> > client.prepareDelete().setIndex(indexName).execute().actionGet(TIMEOUT);  
> > } catch (ElasticSearchException ignored) {  
> > System.out.println(ignored)  
> > }
> > 
> > // Prepare new index with settings  
> > Settings settings =  
> > ImmutableSettings.settingsBuilder().put("index.number\_of\_shards", 8)  
> > .put("index.number\_of\_replicas", 1).build();
> > 
> > client.admin().indices().prepareUpdateSettings(indexName).setSettings(settings).execute().actionGet(TIMEOUT);
> > 
> > Thanks a lot!

---

<div class="post-metadata">

**Author:** ![fashionalwallet](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@fashionalwallet](https://discuss.elastic.co/u/fashionalwallet)\
**Post date:** [June 10, 2011, 3:42am UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499/4 "2011-06-10T03:42:47Z")

</div>

- deleted -

---

<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, 4:04am UTC](https://discuss.elastic.co/t/issues-while-creating-an-index-after-updating-from-0-15-to-0-16-1/4499/5 "2017-07-06T04:04:03Z")

</div>


