use of org.molgenis.data.index.exception.IndexException in project molgenis by molgenis.
the class ClientFacade method refreshIndexes.
private void refreshIndexes(List<Index> indexes) {
if (LOG.isTraceEnabled()) {
LOG.trace("Refreshing index(es) '{}' ...", toString(indexes));
}
String[] indexNames = toIndexNames(indexes);
RefreshRequestBuilder refreshRequest = client.admin().indices().prepareRefresh(indexNames);
RefreshResponse refreshResponse;
try {
refreshResponse = refreshRequest.get();
} catch (ResourceNotFoundException e) {
LOG.debug("", e);
throw new UnknownIndexException(toIndexNames(indexes));
} catch (ElasticsearchException e) {
LOG.error("", e);
throw new IndexException(format("Error refreshing index(es) '%s'.", toString(indexes)));
}
if (refreshResponse.getFailedShards() > 0) {
LOG.error(stream(refreshResponse.getShardFailures()).map(ShardOperationFailedException::toString).collect(joining("\n")));
throw new IndexException(format("Error refreshing index(es) '%s'.", toString(indexes)));
}
if (LOG.isDebugEnabled()) {
LOG.debug("Refreshed index(es) '{}'", toString(indexes));
}
}
Aggregations