Search in sources :

Example 1 with GetTaskRequest

use of org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest in project elasticsearch by elastic.

the class RestGetTaskAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    TaskId taskId = new TaskId(request.param("taskId"));
    boolean waitForCompletion = request.paramAsBoolean("wait_for_completion", false);
    TimeValue timeout = request.paramAsTime("timeout", null);
    GetTaskRequest getTaskRequest = new GetTaskRequest();
    getTaskRequest.setTaskId(taskId);
    getTaskRequest.setWaitForCompletion(waitForCompletion);
    getTaskRequest.setTimeout(timeout);
    return channel -> client.admin().cluster().getTask(getTaskRequest, new RestToXContentListener<>(channel));
}
Also used : BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) Settings(org.elasticsearch.common.settings.Settings) GET(org.elasticsearch.rest.RestRequest.Method.GET) GetTaskRequest(org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest) RestToXContentListener(org.elasticsearch.rest.action.RestToXContentListener) TimeValue(org.elasticsearch.common.unit.TimeValue) RestRequest(org.elasticsearch.rest.RestRequest) NodeClient(org.elasticsearch.client.node.NodeClient) IOException(java.io.IOException) RestController(org.elasticsearch.rest.RestController) TaskId(org.elasticsearch.tasks.TaskId) GetTaskRequest(org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest) TaskId(org.elasticsearch.tasks.TaskId) TimeValue(org.elasticsearch.common.unit.TimeValue)

Aggregations

IOException (java.io.IOException)1 GetTaskRequest (org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest)1 NodeClient (org.elasticsearch.client.node.NodeClient)1 Settings (org.elasticsearch.common.settings.Settings)1 TimeValue (org.elasticsearch.common.unit.TimeValue)1 BaseRestHandler (org.elasticsearch.rest.BaseRestHandler)1 RestController (org.elasticsearch.rest.RestController)1 RestRequest (org.elasticsearch.rest.RestRequest)1 GET (org.elasticsearch.rest.RestRequest.Method.GET)1 RestToXContentListener (org.elasticsearch.rest.action.RestToXContentListener)1 TaskId (org.elasticsearch.tasks.TaskId)1