122 lines
5.3 KiB
Plaintext
122 lines
5.3 KiB
Plaintext
[[java-rest-high-cluster-put-settings]]
|
|
=== Cluster Update Settings API
|
|
|
|
The Cluster Update Settings API allows to update cluster wide settings.
|
|
|
|
[[java-rest-high-cluster-put-settings-request]]
|
|
==== Cluster Update Settings Request
|
|
|
|
A `ClusterUpdateSettingsRequest`:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request]
|
|
--------------------------------------------------
|
|
|
|
==== Cluster Settings
|
|
At least one setting to be updated must be provided:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request-cluster-settings]
|
|
--------------------------------------------------
|
|
<1> Sets the transient settings to be applied
|
|
<2> Sets the persistent setting to be applied
|
|
|
|
==== Providing the Settings
|
|
The settings to be applied can be provided in different ways:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-create-settings]
|
|
--------------------------------------------------
|
|
<1> Creates a transient setting as `Settings`
|
|
<2> Creates a persistent setting as `Settings`
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-settings-builder]
|
|
--------------------------------------------------
|
|
<1> Settings provided as `Settings.Builder`
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-settings-source]
|
|
--------------------------------------------------
|
|
<1> Settings provided as `String`
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-settings-map]
|
|
--------------------------------------------------
|
|
<1> Settings provided as a `Map`
|
|
|
|
==== Optional Arguments
|
|
The following arguments can optionally be provided:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request-timeout]
|
|
--------------------------------------------------
|
|
<1> Timeout to wait for the all the nodes to acknowledge the settings were applied
|
|
as a `TimeValue`
|
|
<2> Timeout to wait for the all the nodes to acknowledge the settings were applied
|
|
as a `String`
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request-masterTimeout]
|
|
--------------------------------------------------
|
|
<1> Timeout to connect to the master node as a `TimeValue`
|
|
<2> Timeout to connect to the master node as a `String`
|
|
|
|
[[java-rest-high-cluster-put-settings-sync]]
|
|
==== Synchronous Execution
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-execute]
|
|
--------------------------------------------------
|
|
|
|
[[java-rest-high-cluster-put-settings-async]]
|
|
==== Asynchronous Execution
|
|
|
|
The asynchronous execution of a cluster update settings requires both the
|
|
`ClusterUpdateSettingsRequest` instance and an `ActionListener` instance to be
|
|
passed to the asynchronous method:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-execute-async]
|
|
--------------------------------------------------
|
|
<1> The `ClusterUpdateSettingsRequest` to execute and the `ActionListener`
|
|
to use when the execution completes
|
|
|
|
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 `ClusterUpdateSettingsResponse` looks like:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-execute-listener]
|
|
--------------------------------------------------
|
|
<1> Called when the execution is successfully completed. The response is
|
|
provided as an argument
|
|
<2> Called in case of a failure. The raised exception is provided as an argument
|
|
|
|
[[java-rest-high-cluster-put-settings-response]]
|
|
==== Cluster Update Settings Response
|
|
|
|
The returned `ClusterUpdateSettings` allows to retrieve information about the
|
|
executed operation as follows:
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-response]
|
|
--------------------------------------------------
|
|
<1> Indicates whether all of the nodes have acknowledged the request
|
|
<2> Indicates which transient settings have been applied
|
|
<3> Indicates which persistent settings have been applied |