| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | [[java-rest-high-cluster-put-settings]]=== Cluster Update Settings APIThe Cluster Update Settings API allows to update cluster wide settings.[[java-rest-high-cluster-put-settings-request]]==== Cluster Update Settings RequestA `ClusterUpdateSettingsRequest`:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request]--------------------------------------------------==== Cluster SettingsAt 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 SettingsThe 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 ArgumentsThe 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 appliedas a `TimeValue`<2> Timeout to wait for the all the nodes to acknowledge the settings were appliedas 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 ExecutionThe asynchronous execution of a cluster update settings requires both the`ClusterUpdateSettingsRequest` instance and an `ActionListener` instance to bepassed 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 completesThe asynchronous method does not block and returns immediately. Once it iscompleted the `ActionListener` is called back using the `onResponse` methodif the execution successfully completed or using the `onFailure` method ifit 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 isprovided 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 ResponseThe returned `ClusterUpdateSettings` allows to retrieve information about theexecuted 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
 |