Class TasksClient


  • public final class TasksClient
    extends java.lang.Object
    A wrapper for the RestHighLevelClient that provides methods for accessing the Tasks API.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CancelTasksResponse cancel​(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options)
      Cancel one or more cluster tasks using the Task Management API.
      org.opensearch.client.Cancellable cancelAsync​(CancelTasksRequest cancelTasksRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<CancelTasksResponse> listener)
      Asynchronously cancel one or more cluster tasks using the Task Management API.
      java.util.Optional<GetTaskResponse> get​(GetTaskRequest request, org.opensearch.client.RequestOptions options)
      Get a task using the Task Management API.
      org.opensearch.client.Cancellable getAsync​(GetTaskRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.util.Optional<GetTaskResponse>> listener)
      Get a task using the Task Management API.
      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)
      Get current tasks using the Task Management API.
      org.opensearch.client.Cancellable listAsync​(org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)
      Asynchronously get current tasks using the Task Management API.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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 java.io.IOException
        Get current tasks using the Task Management API.
        Parameters:
        request - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response
        Throws:
        java.io.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.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)
        Asynchronously get current tasks using the Task Management API.
        Parameters:
        request - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • get

        public java.util.Optional<GetTaskResponse> get​(GetTaskRequest request,
                                                       org.opensearch.client.RequestOptions options)
                                                throws java.io.IOException
        Get a task using the Task Management API.
        Parameters:
        request - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response
        Throws:
        java.io.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.action.ActionListener<java.util.Optional<GetTaskResponse>> listener)
        Get a task using the Task Management API.
        Parameters:
        request - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - 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 java.io.IOException
        Cancel one or more cluster tasks using the Task Management API.
        Parameters:
        cancelTasksRequest - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response
        Throws:
        java.io.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.action.ActionListener<CancelTasksResponse> listener)
        Asynchronously cancel one or more cluster tasks using the Task Management API.
        Parameters:
        cancelTasksRequest - the request
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request