// See if the index version exists and check if it matches. The request will
// fail if there is no version index
boolean versionIndexExists = false;
GetRequestBuilder getRequestBuilder = nodeClient.prepareGet(site.getIdentifier(), VERSION_TYPE, ROOT_ID);
try {
GetResponse response = getRequestBuilder.execute().actionGet();
if (response.exists() && response.field(VERSION) != null) {
indexVersion = Integer.parseInt((String) response.field(VERSION).getValue());
versionIndexExists = true;
logger.debug("Search index version is {}", indexVersion);
}