| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | [[java-rest-high-cluster-get-settings]]=== Cluster Get Settings APIThe Cluster Get Settings API allows to get the cluster wide settings.[[java-rest-high-cluster-get-settings-request]]==== Cluster Get Settings RequestA `ClusterGetSettingsRequest`:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-request]--------------------------------------------------==== Optional argumentsThe following arguments can optionally be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-request-includeDefaults]--------------------------------------------------<1> By default only those settings that were explicitly set are returned. Setting this to true also returnsthe default settings.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-request-local]--------------------------------------------------<1> By default the request goes to the master of the cluster to get the latest results. If local is specified it getsthe results from whichever node the request goes to.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-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-get-settings-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-execute]--------------------------------------------------<1> Execute the request and get back the response in a `ClusterGetSettingsResponse` object.[[java-rest-high-cluster-get-settings-async]]==== Asynchronous ExecutionThe asynchronous execution of a cluster get settings requires both the`ClusterGetSettingsRequest` instance and an `ActionListener` instance to bepassed to the asynchronous method:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-execute-async]--------------------------------------------------<1> The `ClusterGetSettingsRequest` 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 `ClusterGetSettingsResponse` looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-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-get-settings-response]]==== Cluster Get Settings ResponseThe returned `ClusterGetSettingsResponse` allows to retrieve information about theexecuted operation as follows:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-settings-response]--------------------------------------------------<1> Get the persistent settings.<2> Get the transient settings.<3> Get the default settings (returns empty settings if `includeDefaults` was not set to `true`).<4> Get the value as a `String` for a particular setting. The order of searching is first in `persistentSettings` then in`transientSettings` and finally, if not found in either, in `defaultSettings`.
 |