- Java REST Client (deprecated): other versions:
- Overview
- Java Low Level REST Client
- Java High Level REST Client
Update Indices Settings API
editUpdate Indices Settings API
editThe Update Indices Settings API allows to change specific index level settings.
Update Indices Settings Request
editAn UpdateSettingsRequest
:
Indices Settings
editAt least one setting to be updated must be provided:
Providing the Settings
editThe settings to be applied can be provided in different ways:
String settingKey = "index.number_of_replicas"; int settingValue = 0; Settings settings = Settings.builder() .put(settingKey, settingValue) .build();
Settings.Builder settingsBuilder = Settings.builder() .put(settingKey, settingValue); request.settings(settingsBuilder);
Optional Arguments
editThe following arguments can optionally be provided:
Whether to update existing settings. If set to |
Timeout to wait for the all the nodes to acknowledge the new setting
as a |
|
Timeout to wait for the all the nodes to acknowledge the new setting
as a |
Timeout to connect to the master node as a |
|
Timeout to connect to the master node as a |
Synchronous Execution
editUpdateSettingsResponse updateSettingsResponse = client.indices().putSettings(request);
Asynchronous Execution
editThe asynchronous execution of an indices update settings requires both the
UpdateSettingsRequest
instance and an ActionListener
instance to be
passed to the asynchronous method:
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for UpdateSettingsResponse
looks like:
Update Indices Settings Response
editThe returned UpdateSettingsResponse
allows to retrieve information about the
executed operation as follows:
On this page