Skip to content

Commit

Permalink
Honor IndicesOptions in HLRC putMapping request (#57118)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christoph Büscher authored May 27, 2020
1 parent 38a17f2 commit 25a19b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static Request putMapping(PutMappingRequest putMappingRequest) throws IOExceptio
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putMappingRequest.timeout());
parameters.withMasterTimeout(putMappingRequest.masterNodeTimeout());
parameters.withIndicesOptions(putMappingRequest.indicesOptions());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
return request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public void testPutMapping() throws IOException {
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(putMappingRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(putMappingRequest, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(putMappingRequest::indicesOptions,
putMappingRequest::indicesOptions, expectedParams);

Request request = IndicesRequestConverters.putMapping(putMappingRequest);

Expand Down

0 comments on commit 25a19b8

Please sign in to comment.