# Used wait\_for\_completion=false but get 404 when trying to query task id

**URL:** <https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355>\
**Category:** Elasticsearch\
**Created:** [July 22, 2022, 12:08am UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355 "2022-07-22T00:08:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdo1](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@mdo1](https://discuss.elastic.co/u/mdo1)\
**Post date:** [July 22, 2022, 12:08am UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/1 "2022-07-22T00:08:38Z")

</div>

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:

```auto
“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?

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [July 22, 2022, 2:42am UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/2 "2022-07-22T02:42:48Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![mdo1](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@mdo1](https://discuss.elastic.co/u/mdo1)\
**Post date:** [July 22, 2022, 7:36pm UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/3 "2022-07-22T19:36:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mdo1](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@mdo1](https://discuss.elastic.co/u/mdo1)\
**Post date:** [July 28, 2022, 11:31pm UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/4 "2022-07-28T23:31:14Z")

</div>

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.

---

<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:** [July 28, 2022, 11:31pm UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/5 "2022-07-28T23:31:14Z")

</div>

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: )

---

<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:** [August 25, 2022, 11:31pm UTC](https://discuss.elastic.co/t/used-wait-for-completion-false-but-get-404-when-trying-to-query-task-id/310355/6 "2022-08-25T23:31:53Z")

</div>

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