Search in sources :

Example 1 with RolloverRequest

use of org.elasticsearch.action.admin.indices.rollover.RolloverRequest in project elasticsearch by elastic.

the class RestRolloverIndexAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index"));
    request.applyContentParser(parser -> RolloverRequest.PARSER.parse(parser, rolloverIndexRequest, null));
    rolloverIndexRequest.dryRun(request.paramAsBoolean("dry_run", false));
    rolloverIndexRequest.timeout(request.paramAsTime("timeout", rolloverIndexRequest.timeout()));
    rolloverIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", rolloverIndexRequest.masterNodeTimeout()));
    rolloverIndexRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards")));
    return channel -> client.admin().indices().rolloverIndex(rolloverIndexRequest, new RestToXContentListener<>(channel));
}
Also used : ActiveShardCount(org.elasticsearch.action.support.ActiveShardCount) BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) Settings(org.elasticsearch.common.settings.Settings) RestToXContentListener(org.elasticsearch.rest.action.RestToXContentListener) RestRequest(org.elasticsearch.rest.RestRequest) NodeClient(org.elasticsearch.client.node.NodeClient) IOException(java.io.IOException) RestController(org.elasticsearch.rest.RestController) RolloverRequest(org.elasticsearch.action.admin.indices.rollover.RolloverRequest) RolloverRequest(org.elasticsearch.action.admin.indices.rollover.RolloverRequest)

Aggregations

IOException (java.io.IOException)1 RolloverRequest (org.elasticsearch.action.admin.indices.rollover.RolloverRequest)1 ActiveShardCount (org.elasticsearch.action.support.ActiveShardCount)1 NodeClient (org.elasticsearch.client.node.NodeClient)1 Settings (org.elasticsearch.common.settings.Settings)1 BaseRestHandler (org.elasticsearch.rest.BaseRestHandler)1 RestController (org.elasticsearch.rest.RestController)1 RestRequest (org.elasticsearch.rest.RestRequest)1 RestToXContentListener (org.elasticsearch.rest.action.RestToXContentListener)1