mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Add Cluster Put Settings API to the high level REST client (#28633)
Relates to #27205
This commit is contained in:
parent
81eda1834b
commit
02fc16f10e
19 changed files with 821 additions and 49 deletions
129
docs/java-rest/high-level/cluster/put_settings.asciidoc
Normal file
129
docs/java-rest/high-level/cluster/put_settings.asciidoc
Normal file
|
@ -0,0 +1,129 @@
|
|||
[[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-flat-settings]
|
||||
--------------------------------------------------
|
||||
<1> Wether the updated settings returned in the `ClusterUpdateSettings` should
|
||||
be in a flat format
|
||||
|
||||
["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
|
|
@ -20,7 +20,7 @@ A description of the fields to create on the mapping; if not defined, the mappin
|
|||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-mapping-request-source]
|
||||
--------------------------------------------------
|
||||
<1> The mapping source provided as a `String`
|
||||
<1> Mapping source provided as a `String`
|
||||
|
||||
==== Providing the mapping source
|
||||
The mapping source can be provided in different ways in addition to
|
||||
|
|
|
@ -71,3 +71,10 @@ include::indices/put_mapping.asciidoc[]
|
|||
include::indices/update_aliases.asciidoc[]
|
||||
include::indices/exists_alias.asciidoc[]
|
||||
|
||||
== Cluster APIs
|
||||
|
||||
The Java High Level REST Client supports the following Cluster APIs:
|
||||
|
||||
* <<java-rest-high-cluster-put-settings>>
|
||||
|
||||
include::cluster/put_settings.asciidoc[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue