Hi, I am using Elasticsearch cluster from the Elastic cloud. The version is 8.10.
I have this strange issue occured. We use the reindex
API with wait_for_completion=False
to create a reindex task.
In the response, we get the task id and then check the status of this task. The first check was successful, but then I get the following error when we check the task status:
NotFoundError(404, 'resource_not_found_exception', "task [PNlPZtvCSBuygFva2Ybjzg:3540981] isn't running and hasn't stored its results
The code is something like this:
response = self.es.reindex(
source=source,
dest=dest,
script=script,
wait_for_completion=False
)
task_id = response['task']
logger.debug("Reindex task started: %s", task_id)
# Monitor progress
while True:
# check status of the running task
response = self.es.tasks.get(task_id=task_id)
task_status = response['task']['status']
doc_count_dst = task_status['created'] + task_status['updated'] + task_status['deleted']
logger.debug("Reindex progress: %d", doc_count_dst)
if response['completed']:
break
time.sleep(0.8)
I am 100% sure we didn't cancel the task or anything. Somehow the task disappears.