I am doing an HTTP post to elasticsearch in scala.
Http(s\"http://$elkIp:5051/$indexName/_delete_by_query\")
.postData(s\"\"\"{ \"query\": { \"term
What you need to do is to add ?wait_for_completion=false to your request and you'll get the <task_id> in the response immediately.
You can then regularly check the task status by hitting /_tasks/<task_id>. As soon as completed: true returns, then you know the task has finished executing.
You need to also make sure to delete .tasks/task/<task_id> when your job is done otherwise it will stay in the task index.