-
Couldn't load subscription status.
- Fork 115
Description
In 8.15.1, the list function on TaskClient accepts a parameter node_id according to the docs:
node_id (Sequence[str] | None) – Comma-separated list of node IDs or names used to limit returned information.
node_id is passed as a query parameter: https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_sync/client/tasks.py#L200
If this parameter is set, _perform_request will fail because it expects nodes not node_id:
elasticsearch.BadRequestError: BadRequestError(400, 'illegal_argument_exception', 'request [/_tasks] contains unrecognized parameter: [node_id] -> did you mean [nodes]?')
If I change the underlying call to self.perform_request to assign the query parameter to key nodes instead of node_id the request succeeds:
es_client.tasks.perform_request("GET", "/_tasks", params={"nodes":["node_id_1", "node_id_2"]}, headers={"accept": "application/json"}, endpoint_id="tasks.list", path_parts={})
but passing nodes to task.list is not accepted.
I believe this line should be changed to:
__query["nodes"] = node_id
Alternatively the list function could be changed from using node_id to using nodes on the query parameters as well as the function parameters.