Honor IndicesOptions in HLRC putMapping request (#57118)

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
This commit is contained in:
Christoph Büscher 2020-05-27 11:58:38 +02:00
parent d6b79bcd95
commit 277c5eaf56
2 changed files with 3 additions and 0 deletions

View File

@ -155,6 +155,7 @@ final class IndicesRequestConverters {
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;

View File

@ -213,6 +213,8 @@ public class IndicesRequestConvertersTests extends ESTestCase {
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);