use of org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder in project sonarqube by SonarSource.
the class ProxyRefreshRequestBuilderTest method trace_logs.
@Test
public void trace_logs() {
logTester.setLevel(LoggerLevel.TRACE);
RefreshRequestBuilder requestBuilder = esTester.client().prepareRefresh(FakeIndexDefinition.INDEX);
requestBuilder.get();
assertThat(logTester.logs(LoggerLevel.TRACE)).hasSize(1);
}
use of org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder in project sonarqube by SonarSource.
the class ProxyRefreshRequestBuilderTest method refresh.
@Test
public void refresh() {
RefreshRequestBuilder requestBuilder = esTester.client().prepareRefresh(FakeIndexDefinition.INDEX);
requestBuilder.get();
}
use of org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder 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