Issues while creating an index after updating from 0.15 to 0.16.1


(nicco) #1

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!


(Shay Banon) #2

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!


(Shay Banon) #3

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!


(fashionalwallet) #4
  • deleted -

(system) #5