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 committed May 27, 2020
1 parent f65c9fe commit 819fb0e
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 @@ -150,6 +150,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 @@ -213,6 +213,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 819fb0e

Please sign in to comment.