org.elasticsearch.action.admin.indices.recovery.RecoveryRequest Java Examples

The following examples show how to use org.elasticsearch.action.admin.indices.recovery.RecoveryRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestRecoveryAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {

    final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
    recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
    recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
    recoveryRequest.indicesOptions(IndicesOptions.fromRequest(request, recoveryRequest.indicesOptions()));

    client.admin().indices().recoveries(recoveryRequest, new RestBuilderListener<RecoveryResponse>(channel) {
        @Override
        public RestResponse buildResponse(RecoveryResponse response, XContentBuilder builder) throws Exception {
            response.detailed(recoveryRequest.detailed());
            builder.startObject();
            response.toXContent(builder, request);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });

}
 
Example #2
Source File: RestRecoveryAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
    recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
    recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
    recoveryRequest.indicesOptions(IndicesOptions.fromRequest(request, recoveryRequest.indicesOptions()));

    client.admin().indices().recoveries(recoveryRequest, new RestResponseListener<RecoveryResponse>(channel) {
        @Override
        public RestResponse buildResponse(final RecoveryResponse response) throws Exception {
            return RestTable.buildResponse(buildRecoveryTable(request, response), channel);
        }
    });
}
 
Example #3
Source File: BaseClient.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
public int waitForRecovery(String index) throws IOException {
    if (client() == null) {
        return -1;
    }
    if (index == null) {
        throw new IOException("unable to waitfor recovery, index not set");
    }
    RecoveryResponse response = client().execute(RecoveryAction.INSTANCE, new RecoveryRequest(index)).actionGet();
    int shards = response.getTotalShards();
    client().execute(ClusterHealthAction.INSTANCE, new ClusterHealthRequest(index).waitForActiveShards(shards)).actionGet();
    return shards;
}
 
Example #4
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<RecoveryResponse> recoveries(final RecoveryRequest request) {
    return execute(RecoveryAction.INSTANCE, request);
}
 
Example #5
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void recoveries(final RecoveryRequest request, final ActionListener<RecoveryResponse> listener) {
    execute(RecoveryAction.INSTANCE, request, listener);
}
 
Example #6
Source File: BaseClient.java    From elasticsearch-helper with Apache License 2.0 4 votes vote down vote up
public void waitForRecovery() throws IOException {
    if (client() == null) {
        return;
    }
    client().execute(RecoveryAction.INSTANCE, new RecoveryRequest()).actionGet();
}
 
Example #7
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<RecoveryResponse> recoveries(final RecoveryRequest request) {
    return execute(RecoveryAction.INSTANCE, request);
}
 
Example #8
Source File: AbstractClient.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void recoveries(final RecoveryRequest request, final ActionListener<RecoveryResponse> listener) {
    execute(RecoveryAction.INSTANCE, request, listener);
}
 
Example #9
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Indices recoveries
 */
ActionFuture<RecoveryResponse> recoveries(RecoveryRequest request);
 
Example #10
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 *Indices recoveries
 */
void recoveries(RecoveryRequest request, ActionListener<RecoveryResponse> listener);
 
Example #11
Source File: IndicesAdminClient.java    From crate with Apache License 2.0 2 votes vote down vote up
/**
 * Indices recoveries
 */
ActionFuture<RecoveryResponse> recoveries(RecoveryRequest request);
 
Example #12
Source File: IndicesAdminClient.java    From crate with Apache License 2.0 2 votes vote down vote up
/**
 *Indices recoveries
 */
void recoveries(RecoveryRequest request, ActionListener<RecoveryResponse> listener);