Skip to content

Allow passing any request parameter to the create index API#642

Merged
dliappis merged 1 commit intoelastic:masterfrom
dliappis:allow-any-request-parameter-for-create-index
Feb 6, 2019
Merged

Allow passing any request parameter to the create index API#642
dliappis merged 1 commit intoelastic:masterfrom
dliappis:allow-any-request-parameter-for-create-index

Conversation

@dliappis
Copy link
Copy Markdown
Contributor

@dliappis dliappis commented Feb 6, 2019

elastic/rally-tracks#64 requires passing a
parameter in the create-index runner, however, the underlying ES Python
client method[1] doesn't support it. Additionally our docs[2] hint
that this is possible, but it isn't.
This leads to errors like:
create() got an unexpected keyword argument 'include_type_name'.

This isn't caught by unit tests as the ES client is mocked and an
integration test is needed (TODO in a separate PR).

Directly call es.transport.perform_request to create an index, allowing
passing of any arbitrary parameter (such as include_type_name) to
the create index Elasticsearch API.

[1] https://elasticsearch-py.readthedocs.io/en/master/api.html?highlight=indices%20create#elasticsearch.client.IndicesClient.create
[2] https://esrally.readthedocs.io/en/stable/track.html#create-index

elastic/rally-tracks#64 requires passing a
parameter in the create-index runner, however, the underlying ES Python
client method[1] doesn't support it. Additionally our docs[2] hint
that this is possible, but it isn't.

This isn't caught by unit tests as the ES client is mocked and an
integration test is needed (TODO in a separate PR).

Directly call es.transport.perform_request to create an index, allowing
passing of any arbitrary parameter (such as `include_type_name`) to
the create index Elasticsearch API.

[1] https://elasticsearch-py.readthedocs.io/en/master/api.html?highlight=indices%20create#elasticsearch.client.IndicesClient.create
[2] https://esrally.readthedocs.io/en/stable/track.html#create-index
@dliappis dliappis added enhancement Improves the status quo :misc Changes that don't affect users directly: linter fixes, test improvements, etc. labels Feb 6, 2019
@dliappis dliappis added this to the 1.0.4 milestone Feb 6, 2019
Copy link
Copy Markdown
Contributor

@ebadyano ebadyano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Thank you.

@dliappis
Copy link
Copy Markdown
Contributor Author

dliappis commented Feb 6, 2019

We'll need to add an integration test to catch what the unit test didn't catch here (i.e. passing parameters for create-index), but I thought it can be done in a separate PR.

@dliappis dliappis merged commit 31d5bfb into elastic:master Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improves the status quo :misc Changes that don't affect users directly: linter fixes, test improvements, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants