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

Rest High Level client putMapping operation doesn't respect IndicesOptions.lenientExpandOpen() #57045

Closed
Evgueni-Gordienko opened this issue May 21, 2020 · 3 comments · Fixed by #57118
Assignees
Labels
>bug Team:Data Management Meta label for data/management team

Comments

@Evgueni-Gordienko
Copy link

Evgueni-Gordienko commented May 21, 2020

Elasticsearch version (bin/elasticsearch --version): the latest

JVM version (java -version): 1.8

OS version (uname -a if on a Unix-like system): Mas OS

Description of the problem including expected versus actual behavior:
When performing putMapping operation via Rest High Level Client and setting indices option to lenientExpandOpen an ElasticsearchStatusException is thrown in case when no indices were found. I expect no error to be returned.

Steps to reproduce:
Just perform something like this:

esRestClient.indices()
                        .putMapping(new PutMappingRequest(indices)
                                            .indicesOptions(IndicesOptions.lenientExpandOpen())
                                            .type(type)
                                            .source(mappings),
                                    RequestOptions.DEFAULT);

The root cause is in org.elasticsearch.client.IndicesRequestConverters, line 134.
For some reason, for the putMapping method there is no line like the following:
parameters.withIndicesOptions(putMappingRequest.indicesOptions()); which is present in many other methods of the class.

Because of that the resulting URL doesn't include the following parameters:
?ignore_unavailable=true,allow_no_indices=true,expand_wildcards_open=true,expand_wildcards_closed=false

And hence, I am getting back index_not_found_exception.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Java High Level REST Client)

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label May 22, 2020
@cbuescher cbuescher self-assigned this May 25, 2020
@cbuescher cbuescher removed the needs:triage Requires assignment of a team area label label May 25, 2020
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue May 25, 2020
Currently, the IndicesOptions set on a High Level rest client PutMappingRequest
are not correctly converted to request parameters. This change adds the missing
conversion and tests.

Closes elastic#57045
@cbuescher
Copy link
Member

@Evgueni-Gordienko thanks for raising this, good catch and spot-on analysis. I opened a PR to fix this in the next 7.7 patch version.

@Evgueni-Gordienko
Copy link
Author

@cbuescher sure, thanks for scheduling the fix.

cbuescher pushed a commit that referenced this issue May 27, 2020
Currently, the IndicesOptions set on a High Level rest client PutMappingRequest
are not correctly converted to request parameters. This change adds the missing
conversion and tests.

Closes #57045
cbuescher pushed a commit that referenced this issue May 27, 2020
Currently, the IndicesOptions set on a High Level rest client PutMappingRequest
are not correctly converted to request parameters. This change adds the missing
conversion and tests.

Closes #57045
cbuescher pushed a commit that referenced this issue May 27, 2020
Currently, the IndicesOptions set on a High Level rest client PutMappingRequest
are not correctly converted to request parameters. This change adds the missing
conversion and tests.

Closes #57045
cbuescher pushed a commit that referenced this issue May 27, 2020
Currently, the IndicesOptions set on a High Level rest client PutMappingRequest
are not correctly converted to request parameters. This change adds the missing
conversion and tests.

Closes #57045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Team:Data Management Meta label for data/management team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants