[2.4] Unexpected _tasks wait_for_completion=true output

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=falseduring 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!

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