Used wait_for_completion=false but get 404 when trying to query task id

I’m doing a reindex and have waitForCompletion: false (using Node.js Elasticsearch client). The response gives me a task id, but when I query the task id manually ( /_tasks/<task_id>) I get a 404:

“type”: “resource_not_found_exception”,
        “reason”: “task [<task_id>] 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”
        }

I can query /tasks? and some things come up, but not my reindex task. What am I missing?

Hi @mdo1

If you have the task id execute this query in index .task. If you task exists, it must be save in the index.

Ex: TaskId = 1jX23LruSt-C5FXXMKtegA:628

GET .tasks/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "task.node": {
              "value": "1jX23LruSt-C5FXXMKtegA"
            }
          }
        },
        {
          "term": {
            "task.id": {
              "value": "628"
            }
          }
        }
      ]
    }
  }
}

Thanks for the reply, @RabBit_BR abBit_BR

Hmm... I can do a GET /_tasks? and that returns (though not my task), but if I GET /.tasks/_search the response is an index_not_found_exception/no such index similar to what's in the caused_by section of my initial question.

I'm not sure what the difference between the 2 queries is and why it seems like I might not have a .tasks index. I wonder if the .tasks index might be automatically getting deleted.

I figured out what was going on here. I was using Amazon Opensearch to access Elasticsearch and didn't realize that Opensearch blocked access to certain indices, .tasks being one of them.

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

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