We are testing to see if https://github.com/elasticsearch/elasticsearch/issues/#issue/726
is fixed.
Our test still fails - but differently now. Instead of it hanging, we
get an error.
"Failed to execute phase [query_fetch], total failure; shardFailures
{[na][testindex][0]: No active shards}"
We are creating the index thus:
CreateIndexRequest request = createIndexRequest(indexName);
request.settings("{number_of_shards : 1 }");
client.admin().indices().create(request).actionGet();
Is the index created & ready when "actionGet" method returns?
When we try and search this index immediately after creating it
(theres nothing in the index - we just expect zero results) we get the
above error.
Out of curiosity, we also added the following code, after creating the
index.
This makes it happy - but not sure if thats just because the call
introduces sufficient delay - or whether its what we need to do.
client.admin()
.cluster()
.health(
clusterHealthRequest()
.waitForYellowStatus() // we only have 1 shard - hence
wait for yellow
.timeout(timeValueSeconds(60))
)
.actionGet();