// Make sure the site index exists
try {
IndicesAdminClient indexAdmin = nodeClient.admin().indices();
CreateIndexRequestBuilder siteIdxRequest = indexAdmin.prepareCreate(site.getIdentifier());
logger.debug("Trying to create site index for '{}'", site.getIdentifier());
CreateIndexResponse siteidxResponse = siteIdxRequest.execute().actionGet();
if (!siteidxResponse.acknowledged()) {
throw new ContentRepositoryException("Unable to create site index for '" + site.getIdentifier() + "'");
}
} catch (IndexAlreadyExistsException e) {
logger.info("Detected existing index '{}'", site.getIdentifier());
}