use of org.elasticsearch.action.admin.indices.refresh.RefreshResponse in project elasticsearch by elastic.
the class ESIntegTestCase method refresh.
/**
* Waits for relocations and refreshes all indices in the cluster.
*
* @see #waitForRelocation()
*/
protected final RefreshResponse refresh(String... indices) {
waitForRelocation();
// TODO RANDOMIZE with flush?
RefreshResponse actionGet = client().admin().indices().prepareRefresh(indices).execute().actionGet();
assertNoFailures(actionGet);
return actionGet;
}
use of org.elasticsearch.action.admin.indices.refresh.RefreshResponse in project crate by crate.
the class ESIntegTestCase method refresh.
/**
* Waits for relocations and refreshes all indices in the cluster.
*
* @see #waitForRelocation()
*/
protected final RefreshResponse refresh(String... indices) {
waitForRelocation();
// TODO RANDOMIZE with flush?
RefreshResponse actionGet = client().admin().indices().prepareRefresh(indices).execute().actionGet();
assertNoFailures(actionGet);
return actionGet;
}
use of org.elasticsearch.action.admin.indices.refresh.RefreshResponse 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);
RefreshRequest refreshRequest = new RefreshRequest(indexNames);
RefreshResponse refreshResponse;
try {
refreshResponse = client.indices().refresh(refreshRequest, DEFAULT);
} catch (ElasticsearchException e) {
if (e.status().getStatus() == 404) {
throw new UnknownIndexException(indexes.stream().map(Index::getName).toList(), e);
}
throw new IndexRefreshException(indexes.stream().map(Index::getName).toList());
} catch (IOException e) {
throw new IndexRefreshException(indexes.stream().map(Index::getName).toList(), e);
}
if (refreshResponse.getFailedShards() > 0) {
if (LOG.isErrorEnabled()) {
LOG.error(stream(refreshResponse.getShardFailures()).map(ShardOperationFailedException::toString).collect(joining("\n")));
}
throw new IndexRefreshException(indexes.stream().map(Index::getName).toList());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Refreshed index(es) '{}'", toString(indexes));
}
}
Aggregations