# Getting a task from /\_tasks/taskId always fails 404

**URL:** https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699
**Category:** Elasticsearch
**Created:** [March 15, 2017, 12:25pm UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699 "2017-03-15T12:25:19Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Cylindric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cylindric/32/5660_2.png) [@Cylindric](https://discuss.elastic.co/u/Cylindric)
#### Post date: [March 15, 2017, 12:25pm UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/1 "2017-03-15T12:25:19Z")

</div>

I've started playing around with the `_reindex` commands so I can apply new templates without having to wait a month for the indices to cycle through, and one of the things I want to do sometimes is cancel a task.

When I run `GET _tasks?actions=*reindex` I get a bunch of tasks back, in this example 3:

```
{
  "nodes": {
    "b5UT95DESneKP8DFYCo0qA": {
      "name": "instance-0000000014",
      "transport_address": "1.2.3.4:19611",
      "host": "1.2.3.4",
      "ip": "1.2.3.4:19611",
      "roles": [
        "master",
        "data",
        "ingest"
      ],
      "attributes": {
        "logical_availability_zone": "zone-0",
        "availability_zone": "eu-west-1c",
        "region": "eu-west-1"
      },
      "tasks": {
        "b5UT95DESneKP8DFYCo0qA:3425854": {
          "node": "b5UT95DESneKP8DFYCo0qA",
          "id": 3425854,
          "type": "transport",
          "action": "indices:data/write/reindex",
          "start_time_in_millis": 1489579606713,
          "running_time_in_nanos": 938362403062,
          "cancellable": true
        },
        "b5UT95DESneKP8DFYCo0qA:3372324": {
          "node": "b5UT95DESneKP8DFYCo0qA",
          "id": 3372324,
          "type": "transport",
          "action": "indices:data/write/reindex",
          "start_time_in_millis": 1489578556858,
          "running_time_in_nanos": 1988217249580,
          "cancellable": true
        },
        "b5UT95DESneKP8DFYCo0qA:3426031": {
          "node": "b5UT95DESneKP8DFYCo0qA",
          "id": 3426031,
          "type": "transport",
          "action": "indices:data/write/reindex",
          "start_time_in_millis": 1489579610991,
          "running_time_in_nanos": 934084989343,
          "cancellable": true
        }
      }
    }
  }
}

```

Looking at that, I would have said the task ids were 3425854, 3372324 and 3426031, but when I try to get a single task's details using `GET /_tasks/taskId:3425854` I get a "not found" error:

```
{
  "error": {
    "root_cause": [
      {
        "type": "index_not_found_exception",
        "reason": "no such index",
        "resource.type": "index_expression",
        "resource.id": ".tasks",
        "index_uuid": "_na_",
        "index": ".tasks"
      }
    ],
    "type": "resource_not_found_exception",
    "reason": "task [taskId:3425854] belongs to the node [taskId] which isn't part of the cluster and there is no record of the task",
    "caused_by": {
      "type": "resource_not_found_exception",
      "reason": "task [taskId:3425854] isn't running and hasn't stored its results",
      "caused_by": {
        "type": "index_not_found_exception",
        "reason": "no such index",
        "resource.type": "index_expression",
        "resource.id": ".tasks",
        "index_uuid": "_na_",
        "index": ".tasks"
      }
    }
  },
  "status": 404
}
```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [March 16, 2017, 7:50am UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/2 "2017-03-16T07:50:54Z")

</div>

Are you sure that task hasn't ended between when you get the ID and then call the details for it?

---

<div class="post-metadata">

### Author: ![Cylindric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cylindric/32/5660_2.png) [@Cylindric](https://discuss.elastic.co/u/Cylindric)
#### Post date: [March 20, 2017, 9:18am UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/3 "2017-03-20T09:18:22Z")

</div>

Yes. I've just checked with again to be be sure. I started a reindex job on a 3Gb index, so expect that to take a while.

This shows me the task as expected, with a task is of 13268291:

```
GET /_tasks?detailed=true&actions=*reindex

```

But this gives me the "no such index" errror:

```
GET /_tasks/taskId:13268291

```

Running the list still shows the me the task:

```
GET /_tasks?detailed=true&actions=*reindex
```

---

<div class="post-metadata">

### Author: ![Cylindric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cylindric/32/5660_2.png) [@Cylindric](https://discuss.elastic.co/u/Cylindric)
#### Post date: [March 29, 2017, 9:05am UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/4 "2017-03-29T09:05:47Z")

</div>

Nobody else gets this? Could this be a problem with the version on Cloud?

---

<div class="post-metadata">

### Author: ![blachniet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blachniet/32/11650_2.png) [@blachniet](https://discuss.elastic.co/u/blachniet)
#### Post date: [April 7, 2017, 8:32pm UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/5 "2017-04-07T20:32:41Z")

</div>

I'm also seeing this. Let me know if you figure out a solution.

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [April 7, 2017, 9:06pm UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/6 "2017-04-07T21:06:34Z")

</div>

Currently task ids are all of the form `<some long alphanumeric string that is the node's id>:<a number>`.

That "no such index" error might be a bug - I'm not sure. But the request shouldn't have the actual string `taskId` in it.

---

<div class="post-metadata">

### Author: ![blachniet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blachniet/32/11650_2.png) [@blachniet](https://discuss.elastic.co/u/blachniet)
#### Post date: [April 9, 2017, 1:22pm UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/7 "2017-04-09T13:22:31Z")

</div>

Thanks, your suggestion fixed my problem. I thought we actually needed`taskId:` in the request URL. When I changed the request to something like `GET _tasks/308fwe2be32:1234` it worked as expected.

---

<div class="post-metadata">

### Author: ![Cylindric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cylindric/32/5660_2.png) [@Cylindric](https://discuss.elastic.co/u/Cylindric)
#### Post date: [April 10, 2017, 8:51am UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/8 "2017-04-10T08:51:14Z")

</div>

Aah, great thanks. That is really **not** made clear in the documentation, I'd even go so far as to say the docs are wrong.

```
GET _tasks/task_id:1

```

If this is the case, the example should say:

```
GET _tasks/oTUltX4IQMOUUVeiohTt8A:1
```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 8, 2017, 9:06am UTC](https://discuss.elastic.co/t/getting-a-task-from--tasks-taskid-always-fails-404/78699/9 "2017-05-08T09:06:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
