Org.elasticsearch.action.UnavailableShardsException


(johnesky) #1

I am trying to index a document from the Java API but I keep getting UnavailableShardsException. Please I need help. I don't know what it is I am not doing right. I have the source code and exception below. I am a newbie to Elasticsearch and please I'd appreciate anybody's help.

SOURCE CODE:
ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder();
settings.put("node.client", false);
settings.put("node.data", false);
settings.put("node.name", "Todd, Mark");
settings.put("cluster.name", "elasticsearch");
settings.put("network.host", "192.168.2.9");
settings.put("network.bindHost", "192.168.2.9");
settings.put("network.publishHost", "192.168.2.9");
settings.put("index.number_of_shards", 5);
settings.put("index.number_of_replicas", 1);
settings.build();
Node node = NodeBuilder.nodeBuilder().settings(settings).node();

IndexResponse response = client.prepareIndex("twitter", "tweet", "1")
.setSource(jsonBuilder()
.startObject()
.field("user", "Joke")
.field("postDate", new Date())
.field("message", "trying out Elastic Search")
.endObject()
)
.execute()
.actionGet();

EXCEPTION:

org.elasticsearch.client.node.NodeClusterAdminClient@711b50a1
Exception in thread "main" org.elasticsearch.action.UnavailableShardsException: [twitter][2] [2] shardIt, [0] active : Timeout waiting for [1m], request: index {[twitter][tweet][1], source[{"user":"Joke","postDate":"2012-04-09T08:55:58.030Z","message":"trying out Elastic Search"}]}
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$4.onTimeout(TransportShardReplicationOperationAction.java:401)
at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:269)
at org.elasticsearch.timer.TimerService$ThreadedTimerTask$1.run(TimerService.java:113)
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:662)
Java Result: 1


(johnesky) #2

I finally got it solved...WHAT A RELIEF!


(system) #3