olivere / elastic

Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch
https://olivere.github.io/elastic/
MIT License
7.39k stars 1.15k forks source link

GetTaskResponse missing list of Failures #1590

Closed bgadrian closed 2 years ago

bgadrian commented 2 years ago

Please use the following questions as a guideline to help me answer your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[X ] elastic.v7 (for Elasticsearch 7.x) [X ] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

GetTaskResponse should expose the list of Failures

Please describe the actual behavior

It does not

Any steps to reproduce the behavior?

Running a Task across multiple nodes/shards may lead to partial failures, for example only a slice/bulk failed because of a 429. The GetTask API exposes this Failures array only when it is not empty.

Unfortunately this list of errors is not mentioned in their docs as far as I can tell, but others complain too https://discuss.elastic.co/t/recognizing-succeeded-vs-failed-tasks-w-the-task-management-api/168281

The Task seems to extend the BaseTask which contains this list of failures https://github.com/elastic/elasticsearch/blob/26c86871fc091900952e88e252c36fbfedf8d5fa/server/src/main/java/org/elasticsearch/action/support/tasks/BaseTasksResponse.java#L42

olivere commented 2 years ago

I've looked up the ES code base and can't see that the Get Task API does return such a field. However, the List Tasks API does expose it, and it's already in the TasksListResponse.

The code you mentioned is for BaseTasks (plural), not BaseTask, so without digging deep into it, I suppose it's for a list of tasks, not for a single task.

If you can write a test that returns task_failures from ES for a single call of Get Task API, I'm willing to reopen and dig deeper.