Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body parameters for templates do not work #2180

Closed
honzakral opened this issue Mar 21, 2023 · 1 comment · Fixed by elastic/elasticsearch-specification#2037
Closed

Body parameters for templates do not work #2180

honzakral opened this issue Mar 21, 2023 · 1 comment · Fixed by elastic/elasticsearch-specification#2037

Comments

@honzakral
Copy link
Contributor

Elasticsearch version (bin/elasticsearch --version): 8.6.2

elasticsearch-py version (elasticsearch.__versionstr__): 8.6.2

Description of the problem including expected versus actual behavior: some body parameters, that are meant to be passed in template (a required argument) like settings are documented as being accepted by the API calls but they do not actually work as they are included in the body as top level keys which is not supported and results in 400:

BadRequestError(400, 'x_content_parse_exception', '[1:16] [component_template] unknown field [settings]')

Steps to reproduce:

es = Elasticsearch()
es.cluster.put_component_template(name="ttt", settings={"number_of_shards": 1}, template={})
@sethmlarson
Copy link
Contributor

Hey Honza, indeed it looks like the Elasticsearch API specification got this wrong. I've created a PR which removes the incorrectly nested fields for this API request. This will get fixed during the next round of code generation.

For now you can pass the settings field within the template object as is expected by Elasticsearch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants