I'm new to Elastic search, the project is fantastic! In fact it works very
well most of the time. But once in a while (not sure when exactly) I get
this exception:
=======================
org.elasticsearch.action.UnavailableShardsException: [autopage][0] [2]
shardIt, [0] active : Timeout waiting for [1m], request: index
{[XXX][YYY][4], source[{"title":"A title","body":"A body"}]}
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$3.onTimeout(TransportShardReplicationOperationAction.java:419)
at
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:305)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
=======================
Things to know:
-
I use Elastic Search as an embeded search server in a Java web
application (using the Play framework, but not using the Play Elastic module
written by Felipe Oliveira ). -
I currently don't really need replication. My web application is not
critical and I have a way to reindex eveything easily if a problem occures. -
I want something simple: I start my Java application, it starts the
Elastic Search server. No external Elastic server. -
I would prefere not to use any external .yml configuration file. I'd
prefere to set all settings using Java directly. -
Here's the way I currently start Elastic in my application (thanks to
Felipe Oliveira of the Play Elastic Module, I learned a lot from his code):
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("client.transport.sniff", true);
settings.put("path.home", "/path/to/elastic/home");
// test
settings.put("index.number_of_replicas", 1);
settings.put("action.write_consistency", "one");
settings.build();
NodeBuilder nb = new NodeBuilder().settings(settings)
.local(true)
.client(false)
.clusterName(clusterName)
.data(true);
Node node = nb.node();
Client client = node.client();
I'm not sure about the "index.number_of_replicas" and
"action.write_consistency" settings. I think they may have something to do
with my problem (ie:
http://elasticsearch-users.115913.n3.nabble.com/org-elasticsearch-action-UnavailableShardsException-td2210314.html
) but I don't know what I need to use for those settings. I still have
UnavailableShardsExceptions with those current settings (I had the
exceptions without them too!).
Again, I'm a newbie and I'm still not sure to understand the differences
between indices, shards, nodes, etc.
What settings would you recommend for my application?
Thanks a lot for any help!