Tasks Client

class opensearchpy.client.tasks.TasksClient(client)[source]

Bases: NamespacedClient

Parameters:

client (Any) –

cancel(task_id=None, params=None, headers=None)[source]

Cancels a task, if it can be cancelled through an API.

Parameters:
  • task_id (Any) – ID of the task.

  • actions – Comma-separated list or wildcard expression of actions used to limit the request.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • nodes – Comma-separated list of node IDs or names used to limit the request.

  • parent_task_id – Parent task ID used to limit the tasks.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • wait_for_completion – Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false Default is false.

  • task_id

  • params (Any) –

  • headers (Any) –

Return type:

Any

get(task_id=None, params=None, headers=None)[source]

Returns information about a task.

Parameters:
  • task_id (Any) – ID of the task.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_completion – If true, the request blocks until the task has completed. Default is false.

  • task_id

  • params (Any) –

  • headers (Any) –

Return type:

Any

list(params=None, headers=None)[source]

Returns a list of tasks.

Parameters:
  • actions – Comma-separated list or wildcard expression of actions used to limit the request.

  • detailed – If true, the response includes detailed information about shard recoveries. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • group_by – Key used to group tasks in the response. Valid choices are nodes, parents, none.

  • human – Whether to return human readable values for statistics.

  • nodes – Comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes.

  • parent_task_id – Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of -1.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_completion – If true, the request blocks until the operation is complete. Default is false.

  • params (Any) –

  • headers (Any) –

Return type:

Any