Hi, 

I am using the following java code to create instance of ElasticSearch 
instance and create a index called "testindex".

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
}

Before creating the index I am checking whether index exists or not, I only 
create the index if it exists. 
Second time when I am running the above code, it fails with 
IndexAlreadyExistsException. 
It seems like the IndicesExistsResponse.isExists() is not behaving 
correctly. 

Above code works fine if default elasticsearch.yml file is present in the 
classpath. IndicesExistResponse.isExists() returns true if 
elasticsearch.yml is in the classpath.

Any workaround to resolve the issues ?


Regards,
Saurabh Saxena

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/7b7a3e91-b023-4412-8c59-504fdb427369%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to