<p dir="auto">Hi,</p>
<p dir="auto">I am using the following java code to create instance of ElasticSearch instance and create a index called "testindex".</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder()
                                                      .put(&quot;path.data&quot;, &quot;/etc/elasticsearch&quot;)
                                                      .put(&quot;cluster.name&quot;, &quot;testcluster&quot;))
                                      .node();
Client client = node.client();
IndicesAdminClient indices = client.admin().indices();
IndicesExistsResponse res = indices.prepareExists(&quot;testindex&quot;).execute().actionGet();
if(!res.isExists()){ //Everytime getting value as false
  CreateIndexRequestBuilder createIndexRequestBuilder = indices.prepareCreate(&quot;testindex&quot;);
  createIndexRequestBuilder.execute().actionGet(); // Erring out with IndexAlreadyExistsException
}"><pre class="notranslate"><code class="notranslate">Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder()
                                                      .put("path.data", "/etc/elasticsearch")
                                                      .put("cluster.name", "testcluster"))
                                      .node();
Client client = node.client();
IndicesAdminClient indices = client.admin().indices();
IndicesExistsResponse res = indices.prepareExists("testindex").execute().actionGet();
if(!res.isExists()){ //Everytime getting value as false
  CreateIndexRequestBuilder createIndexRequestBuilder = indices.prepareCreate("testindex");
  createIndexRequestBuilder.execute().actionGet(); // Erring out with IndexAlreadyExistsException
}
</code></pre></div>
<p dir="auto">Before creating the index I am checking whether index exists or not, I only create the index if it exists.<br>
Second time when I am running the above code, it fails with IndexAlreadyExistsException.<br>
It seems like the IndicesExistsResponse.isExists() is not behaving correctly.</p>
<p dir="auto">Above code works fine if default elasticsearch.yml file is present in the classpath.</p>
<p dir="auto">I have a problem with the embedded Java client (for testing) after moving our <a href="https://github.com/molindo/esi4j">our Java integration library</a> from 1.0 to 1.4.0.Beta. We use the Java client embedded.</p>
<p dir="auto">During application restart, we check if an index exists and create or update it. Now we have the problem, that <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/indices-exists.html" rel="nofollow">indices exists</a> returns false, causing <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/indices-create-index.html" rel="nofollow">create index</a> to fail.</p>
<p dir="auto">I tried IRC for a solution but <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karmi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/karmi">@karmi</a> thought it's supposedly a bug.</p>
<p dir="auto">(test case to follow)</p>