Tasks

class elasticsearch.client.TasksClient(client)
Parameters:

client (BaseClient) –

cancel(*, task_id=None, actions=None, error_trace=None, filter_path=None, human=None, nodes=None, parent_task_id=None, pretty=None, wait_for_completion=None)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/tasks.html

Parameters:
  • task_id (int | str | None) – ID of the task.

  • actions (str | Sequence[str] | None) – Comma-separated list or wildcard expression of actions used to limit the request.

  • nodes (Sequence[str] | None) – Comma-separated list of node IDs or names used to limit the request.

  • parent_task_id (str | None) – Parent task ID used to limit the tasks.

  • wait_for_completion (bool | None) – Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, task_id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None, wait_for_completion=None)

Returns information about a task.

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/tasks.html

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

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – 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 (bool | None) – If true, the request blocks until the task has completed.

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

list(*, actions=None, detailed=None, error_trace=None, filter_path=None, group_by=None, human=None, master_timeout=None, node_id=None, parent_task_id=None, pretty=None, timeout=None, wait_for_completion=None)

Returns a list of tasks.

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/tasks.html

Parameters:
  • actions (str | Sequence[str] | None) – Comma-separated list or wildcard expression of actions used to limit the request.

  • detailed (bool | None) – If true, the response includes detailed information about shard recoveries.

  • group_by (Literal['nodes', 'none', 'parents'] | str | None) – Key used to group tasks in the response.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • node_id (Sequence[str] | None) – Comma-separated list of node IDs or names used to limit returned information.

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

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – 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 (bool | None) – If true, the request blocks until the operation is complete.

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]