Heya, setting the write consistency is not relevant to this case (since the index request will wait for at least one shard to be available already, and with 1 replica, it does not matter). But, there is a problem (only applies when a new index is being allocated): https://github.com/elasticsearch/elasticsearch/issues/736 (already fixed).
Note, if you use the cluster health API after you create the index and wait for yellow status, then this problem will not happen.
On Wednesday, March 2, 2011 at 4:05 AM, Curtis Caravone wrote:
I'm trying out elasticsearch (0.15.0) through the Java API. To do so, I wrote a simple unit test that starts an embedded instance, indexes a document, then searches for the document: https://gist.github.com/b204814d5f26b7040cc6
If I remove the WriteConsistencyLevel.QUORUM setting from the indexing operation, then about half of the time, even after a refresh, I fail to find the document at search time (I thought the default consistency level was QUORUM or ALL).
If I change the write consistency to WriteConsistencyLevel.ALL, then the test seems to hang at the indexing step.