Getting a task from /_tasks/taskId always fails 404

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
}

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

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

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

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

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.

1 Like

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

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
3 Likes

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