# \[2.4\] Unexpected \_tasks wait\_for\_completion=true output

**URL:** https://discuss.elastic.co/t/2-4-unexpected-tasks-wait-for-completion-true-output/140171
**Category:** Elasticsearch
**Created:** [July 16, 2018, 3:07pm UTC](https://discuss.elastic.co/t/2-4-unexpected-tasks-wait-for-completion-true-output/140171 "2018-07-16T15:07:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![strayerror](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@strayerror](https://discuss.elastic.co/u/strayerror)
#### Post date: [July 16, 2018, 3:07pm UTC](https://discuss.elastic.co/t/2-4-unexpected-tasks-wait-for-completion-true-output/140171/1 "2018-07-16T15:07:58Z")

</div>

When using the `_tasks` endpoint with `wait_for_completion=true` the response appears to be from the point in time that the request was initiated, rather than the (to my mind) expected point in time that the task completed.

This conclusion was reached after seeing a `wait_for_completion=true` request that was kicked off almost immediately after a task was started, report a `running_time_in_nanos` value of `306968702` (sub second) and `0` updates. However polling the endpoint with `wait_for_completion=false`during it's execution saw `running_time_in_nanos` exceeed `1060979232523` (17 minutes) and `updates` hit `11000`.

I've had a google around and have been unable to find any notes about this, so while I appreciate that v2 isn't going to change to fix this (if it is a bug), I'm curious to know if this is:

- A) expected behaviour
  - (and if so how to get the "final" result using the \_tasks API, they vanish upon completion in v2)

- B) fixed in a later version of ES
  - Doesn't help me now, but I'd be good information to have

To better clarify my use case, I'm kicking off an `_update_by_query` task, capturing the task ID, and using it to poll the `_tasks` endpoint to capture progress at regular intervals (so I can chart it over time), I also kick off a request with the `wait_for_completion=true` flag so as to ensure that the polling does not miss the final result (because tasks vanish upon completion in v2).

Many thanks!

---

<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 13, 2018, 3:08pm UTC](https://discuss.elastic.co/t/2-4-unexpected-tasks-wait-for-completion-true-output/140171/2 "2018-08-13T15:08:02Z")

</div>

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