Description
Elasticsearch version: 8.11.1
elasticsearch-py
version: 8.13.0
I understand these versions are different, but I think I've noticed a problem in commits on the snapshots create_repository method.
Description of the problem including expected versus actual behaviour:
I am using the Elasticsearch Python client to create a repository in our Elasticsearch deployments in Elastic Cloud Enterprise 3.6.0. The repository storage target is an on-premises Dell ECS appliance that's compatible with S3 protocol. We deploy the configuration for our Elasticsearch cluster (index templates, pipelines, repository etc) using Gitlab CI on a push to our main branch. The first stage of deployment is to test deployment to Elasticsearch in a Docker container on a GitLab Runner host. Since version 8.13.0 of the Python Elasticsearch client, this is now failing to create the repository with the following traceback:
Traceback (most recent call last):
File "datastreams/modules/repositories.py", line 32, in put_all_repo
resp = es.snapshot.create_repository(**repos[r])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/berg/.local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 446, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
TypeError: SnapshotClient.create_repository() got an unexpected keyword argument 'type'
Steps to reproduce:
We store the configuration in Git and supply this payload as the configuration to the create_repository
method.
Payload
{
"name": "snapshot_name",
"type": "s3",
"settings": {
"endpoint": "https://s3.storage.ourdomain.com",
"client": "our_dell_ecs",
"bucket": "OURBUCKET",
"access_key": "username",
"secret_key": "secret"
},
"verify": false
}
Method
es.snapshot.create_repository(**payload_above)
Investigation:
I looked at the commit history of _sync/client/snapshot.py, and it seems like from the last human commit to the last auto-generated docs commit the parameters for the class method have vanished.
Commit History: https://github.com/elastic/elasticsearch-py/commits/main/elasticsearch/_sync/client/snapshot.py
Latest Commit March 10th:
elasticsearch-py/elasticsearch/_sync/client/snapshot.py
Lines 273 to 288 in 53c5ea3
Previous Commit March 7th:
elasticsearch-py/elasticsearch/_sync/client/snapshot.py
Lines 273 to 290 in 45518b0
Looking at the API documentation, there doesn't appear to be any changes to the underlaying Elasticsearch API: https://www.elastic.co/guide/en/elasticsearch/reference/master/put-snapshot-repo-api.html
My guess the commit was squashed/force pushed in such a way that these parameters are missing as we also do not see the lines in the commit diff being removed. I guess could also be lead astray by abstraction with **kwargs parsing happening elsewhere with a closer look. Either way, it isn't working as we would expect vs the Elasticsearch API which has remained static, and the error is thrown by Elasticsearch client parameter validation.