---
type: api
title: Get task information
description: Get information about a task currently running in the cluster.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-tasks-get
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-tasks-get
products:
  - Elasticsearch
---

# Get task information

Availability: 5.0+

## Paths

- `GET` `/_tasks/{task_id}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#bearerauth)

#### Path Parameters

- `task_id` (string Id)
  The task identifier.

## Description

Get information about a task currently running in the cluster.

WARNING: The task management API is new and should still be considered a beta feature.
The API may change in ways that are not backwards compatible.

If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.

## Required authorization

* Cluster privileges: `monitor`

## Query String Parameters

- `timeout` (string Duration · default: 30s)
  The 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` (boolean · default: false)
  If `true`, the request blocks until the task has completed.

## Response

`application/json`

- `completed` (boolean)
- `task` ({} TaskInfo)
  - `action` (string)
  - `cancelled` (boolean)
  - `cancellable` (boolean)
  - `description` (string)
    Human readable text that identifies the particular request that the task is performing.
For example, it might identify the search request being performed by a search task.
Other kinds of tasks have different descriptions, like `_reindex` which has the source and the destination, or `_bulk` which just has the number of requests and the destination indices.
Many requests will have only an empty description because more detailed information about the request is not easily available or particularly helpful in identifying the request.
  - `headers` (map string to string)
  - `id` (number)
  - `node` (string)
  - `running_time` (string Duration)
  - `running_time_in_nanos` (DurationValueUnitNanos)
  - `start_time_in_millis` (EpochTimeUnitMillis)
  - `status` (object)
    The internal status of the task, which varies from task to task.
The format also varies.
While the goal is to keep the status for a particular task consistent from version to version, this is not always possible because sometimes the implementation changes.
Fields might be removed from the status for a particular request so any parsing you do of the status might break in minor releases.
  - `type` (string)
  - `parent_task_id` (number | string TaskId)
- `response` (object)
- `error` ({} ErrorCause)
  - `type` (string)
    The type of error
  - `reason` (union string) — nullable
    A human-readable explanation of the error, in English.
    One of: `string`
  - `stack_trace` (string)
    The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
  - `caused_by` ({} ErrorCause) — recursive
    Same fields as `error`
  - `root_cause` ([] ErrorCause) — recursive
    Same fields as `error`
  - `suppressed` ([] ErrorCause) — recursive
    Same fields as `error`
## Code Examples

#### Console

```console
GET _tasks?detailed=true&actions=*/delete/byquery
```

#### JavaScript

```javascript
const response = await client.tasks.list({
  detailed: "true",
  actions: "*/delete/byquery",
});
```

#### Python

```python
resp = client.tasks.list(
    detailed=True,
    actions="*/delete/byquery",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### C#

```c#
var response = await client.Tasks
    .ListAsync(d1 => d1
        .Actions("*/delete/byquery")
        .Detailed(true)
    );
```

#### PHP

```php
$resp = $client->tasks()->list([
    "detailed" => "true",
    "actions" => "*/delete/byquery",
]);
```

#### Ruby

```ruby
response = client.tasks.list(
  detailed: "true",
  actions: "*/delete/byquery"
)
```

## Response Examples

#### Get cluster actions

A successful response from `GET _tasks?actions=cluster:*`, which retrieves all cluster-related tasks.

```json
{
  "nodes" : {
    "oTUltX4IQMOUUVeiohTt8A" : {
      "name" : "H5dfFeA",
      "transport_address" : "127.0.0.1:9300",
      "host" : "127.0.0.1",
      "ip" : "127.0.0.1:9300",
      "tasks" : {
        "oTUltX4IQMOUUVeiohTt8A:124" : {
          "node" : "oTUltX4IQMOUUVeiohTt8A",
          "id" : 124,
          "type" : "direct",
          "action" : "cluster:monitor/tasks/lists[n]",
          "start_time_in_millis" : 1458585884904,
          "running_time_in_nanos" : 47402,
          "cancellable" : false,
          "parent_task_id" : "oTUltX4IQMOUUVeiohTt8A:123"
        },
        "oTUltX4IQMOUUVeiohTt8A:123" : {
          "node" : "oTUltX4IQMOUUVeiohTt8A",
          "id" : 123,
          "type" : "transport",
          "action" : "cluster:monitor/tasks/lists",
          "start_time_in_millis" : 1458585884904,
          "running_time_in_nanos" : 236042,
          "cancellable" : false
        }
      }
    }
  }
}
```

#### Get details about a delete by query

A successful response from `GET _tasks?detailed=true&actions=*/delete/byquery`, which gets the status of a delete by query operation. The `status` object contains the actual status. `total` is the total number of operations that the reindex expects to perform. You can estimate the progress by adding the `updated`, `created`, and `deleted` fields. The request will finish when their sum is equal to the `total` field.

```json
{
  "nodes" : {
    "r1A2WoRbTwKZ516z6NEs5A" : {
      "name" : "r1A2WoR",
      "transport_address" : "127.0.0.1:9300",
      "host" : "127.0.0.1",
      "ip" : "127.0.0.1:9300",
      "attributes" : {
        "testattr" : "test",
        "portsfile" : "true"
      },
      "tasks" : {
        "r1A2WoRbTwKZ516z6NEs5A:36619" : {
          "node" : "r1A2WoRbTwKZ516z6NEs5A",
          "id" : 36619,
          "type" : "transport",
          "action" : "indices:data/write/delete/byquery",
          "status" : {    
            "total" : 6154,
            "updated" : 0,
            "created" : 0,
            "deleted" : 3500,
            "batches" : 36,
            "version_conflicts" : 0,
            "noops" : 0,
            "retries": 0,
            "throttled_millis": 0
          },
          "description" : ""
        }
      }
    }
  }
}
```

