}
} else {
logger.debug("Ignoring index: Name {} does not match the supported pattern ({})", index, pattern.pattern());
}
IndicesAdminClient indicesAdminClient = adminClient.indices();
if (!toClose.isEmpty()) {
logger.info("Closing indices: {}", toClose);
String[] indices = toClose.toArray(new String[toClose.size()]);
CloseIndexRequest req = indicesAdminClient.prepareClose(indices).request();
indicesAdminClient.close(req).actionGet();
}
if (!toDelete.isEmpty()) {
logger.info("Deleting indices: {}", toDelete);
String[] indices = toDelete.toArray(new String[toDelete.size()]);
DeleteIndexRequest req = indicesAdminClient.prepareDelete(indices).request();
indicesAdminClient.delete(req).actionGet();
}
}
} catch (ElasticsearchException e) {