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) – The task ID.

  • actions – A comma-separated list of actions that should be returned. Keep empty to return all.

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

  • filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.

  • human – Whether to return human readable values for statistics. Default is True.

  • nodes – A comma-separated list of node IDs or names used to limit the returned information. Use _local to return information from the node you’re connecting to, specify the node name to get information from a specific node, or keep the parameter empty to get information from all nodes.

  • parent_task_id – Returns tasks with a specified parent task ID (node_id:task_number). Keep empty or set to -1 to return all.

  • pretty – Whether to pretty format the returned JSON response. Default is false.

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

  • wait_for_completion – Waits for the matching task to complete. When true, the request is blocked until the task has completed. 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) – The task ID.

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

  • filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.

  • human – Whether to return human readable values for statistics. Default is True.

  • pretty – Whether to pretty format the returned JSON response. Default is false.

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

  • timeout – The amount of time to wait for a response.

  • wait_for_completion – Waits for the matching task to complete. When true, the request is blocked 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 – A comma-separated list of actions that should be returned. Keep empty to return all.

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

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

  • filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.

  • group_by – Groups tasks by parent/child relationships or nodes. Valid choices are nodes, none, parents.

  • human – Whether to return human readable values for statistics. Default is True.

  • nodes – A comma-separated list of node IDs or names used to limit the returned information. Use _local to return information from the node you’re connecting to, specify the node name to get information from a specific node, or keep the parameter empty to get information from all nodes.

  • parent_task_id – Returns tasks with a specified parent task ID (node_id:task_number). Keep empty or set to -1 to return all.

  • pretty – Whether to pretty format the returned JSON response. Default is false.

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

  • timeout – The amount of time to wait for a response.

  • wait_for_completion – Waits for the matching task to complete. When true, the request is blocked until the task has completed. Default is false.

  • params (Any) –

  • headers (Any) –

Return type:

Any