Package org.opensearch.client
Class TasksClient
java.lang.Object
org.opensearch.client.TasksClient
A wrapper for the
RestHighLevelClient that provides methods for accessing the Tasks API.-
Method Summary
Modifier and TypeMethodDescriptioncancel(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options) Cancel one or more cluster tasks using the Task Management API.org.opensearch.client.CancellablecancelAsync(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<CancelTasksResponse> listener) Asynchronously cancel one or more cluster tasks using the Task Management API.get(GetTaskRequest request, org.opensearch.client.RequestOptions options) Get a task using the Task Management API.org.opensearch.client.CancellablegetAsync(GetTaskRequest request, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<Optional<GetTaskResponse>> listener) Get a task using the Task Management API.org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponselist(org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest request, org.opensearch.client.RequestOptions options) Get current tasks using the Task Management API.org.opensearch.client.CancellablelistAsync(org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest request, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener) Asynchronously get current tasks using the Task Management API.
-
Method Details
-
list
public org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse list(org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest request, org.opensearch.client.RequestOptions options) throws IOException Get current tasks using the Task Management API.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
IOException- in case there is a problem sending the request or parsing back the response
-
listAsync
public org.opensearch.client.Cancellable listAsync(org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest request, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener) Asynchronously get current tasks using the Task Management API.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
get
public Optional<GetTaskResponse> get(GetTaskRequest request, org.opensearch.client.RequestOptions options) throws IOException Get a task using the Task Management API.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
IOException- in case there is a problem sending the request or parsing back the response
-
getAsync
public org.opensearch.client.Cancellable getAsync(GetTaskRequest request, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<Optional<GetTaskResponse>> listener) Get a task using the Task Management API.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- an actionlistener that takes an optional response (404s are returned as an empty Optional)- Returns:
- cancellable that may be used to cancel the request
-
cancel
public CancelTasksResponse cancel(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options) throws IOException Cancel one or more cluster tasks using the Task Management API.- Parameters:
cancelTasksRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
IOException- in case there is a problem sending the request or parsing back the response
-
cancelAsync
public org.opensearch.client.Cancellable cancelAsync(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options, org.opensearch.core.action.ActionListener<CancelTasksResponse> listener) Asynchronously cancel one or more cluster tasks using the Task Management API.- Parameters:
cancelTasksRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-