if (null != settings) { // Need to create the index
for (int i = 0; i < 10; i++) { // retry up to 10 times if NoNodeAvailableException found
try {
CreateIndexRequest cir = new CreateIndexRequest(_sIndexName);
String sCachePolicy = properties.getElasticCachePolicy();
if (null != sCachePolicy) {
settings.put("index.cache.field.type", sCachePolicy);
}
if (null != sMapping) {
cir.mapping(_sIndexType, sMapping);
}
cir.settings(settings.build());
_elasticClient.admin().indices().create(cir).actionGet();
//(Wait for above operation to be completed)
_elasticClient.admin().cluster().health(new ClusterHealthRequest(_sIndexName).waitForYellowStatus()).actionGet();
break;