2013-08-28 19:24:34 -04:00
|
|
|
[[cluster-update-settings]]
|
2019-10-22 13:27:31 -04:00
|
|
|
=== Cluster update settings API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Cluster update settings</titleabbrev>
|
|
|
|
++++
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
Updates cluster-wide settings.
|
2018-07-26 11:15:10 -04:00
|
|
|
|
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
[[cluster-update-settings-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`PUT /_cluster/settings`
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-update-settings-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
With specifications in the request body, this API call can update cluster
|
|
|
|
settings. Updates to settings can be persistent, meaning they apply across
|
|
|
|
restarts, or transient, where they don't survive a full cluster restart.
|
|
|
|
|
|
|
|
You can reset persistent or transient settings by assigning a `null` value. If a
|
|
|
|
transient setting is reset, the first one of these values that is defined is
|
|
|
|
applied:
|
|
|
|
|
|
|
|
* the persistent setting
|
|
|
|
* the setting in the configuration file
|
|
|
|
* the default value.
|
|
|
|
|
|
|
|
The order of precedence for cluster settings is:
|
|
|
|
|
|
|
|
1. transient cluster settings
|
|
|
|
2. persistent cluster settings
|
|
|
|
3. settings in the `elasticsearch.yml` configuration file.
|
|
|
|
|
|
|
|
It's best to set all cluster-wide settings with the `settings` API and use the
|
|
|
|
`elasticsearch.yml` file only for local configurations. This way you can be sure that
|
|
|
|
the setting is the same on all nodes. If, on the other hand, you define different
|
|
|
|
settings on different nodes by accident using the configuration file, it is very
|
|
|
|
difficult to notice these discrepancies.
|
|
|
|
|
|
|
|
You can find the list of settings that you can dynamically update in
|
|
|
|
<<modules,Modules>>.
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-update-settings-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
2018-07-26 11:15:10 -04:00
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=flat-settings]
|
2018-10-30 03:58:32 -04:00
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
`include_defaults`::
|
|
|
|
(Optional, boolean) If `true`, returns all default cluster settings.
|
|
|
|
Defaults to `false`.
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-update-settings-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
An example of a persistent update:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
PUT /_cluster/settings
|
|
|
|
{
|
2013-08-28 19:24:34 -04:00
|
|
|
"persistent" : {
|
2017-02-10 17:57:43 -05:00
|
|
|
"indices.recovery.max_bytes_per_sec" : "50mb"
|
2015-06-22 17:49:45 -04:00
|
|
|
}
|
2017-02-10 17:57:43 -05:00
|
|
|
}
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
|
|
|
|
An example of a transient update:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
PUT /_cluster/settings?flat_settings=true
|
|
|
|
{
|
2013-08-28 19:24:34 -04:00
|
|
|
"transient" : {
|
2017-02-10 17:57:43 -05:00
|
|
|
"indices.recovery.max_bytes_per_sec" : "20mb"
|
2015-06-22 17:49:45 -04:00
|
|
|
}
|
2017-02-10 17:57:43 -05:00
|
|
|
}
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
|
|
|
|
The response to an update returns the changed setting, as in this response to
|
|
|
|
the transient example:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2017-02-10 17:57:43 -05:00
|
|
|
...
|
|
|
|
"persistent" : { },
|
2013-08-28 19:24:34 -04:00
|
|
|
"transient" : {
|
2017-02-10 17:57:43 -05:00
|
|
|
"indices.recovery.max_bytes_per_sec" : "20mb"
|
2015-06-22 17:49:45 -04:00
|
|
|
}
|
2017-02-10 17:57:43 -05:00
|
|
|
}
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
// TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2018-07-26 11:15:10 -04:00
|
|
|
|
|
|
|
This example resets a setting:
|
2015-12-07 15:19:40 -05:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2015-12-07 15:19:40 -05:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
PUT /_cluster/settings
|
|
|
|
{
|
2015-12-07 15:19:40 -05:00
|
|
|
"transient" : {
|
2017-02-10 17:57:43 -05:00
|
|
|
"indices.recovery.max_bytes_per_sec" : null
|
2015-12-07 15:19:40 -05:00
|
|
|
}
|
2017-02-10 17:57:43 -05:00
|
|
|
}
|
2015-12-07 15:19:40 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
|
2018-07-26 11:15:10 -04:00
|
|
|
The response does not include settings that have been reset:
|
2015-12-07 15:19:40 -05:00
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2015-12-07 15:19:40 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2017-02-10 17:57:43 -05:00
|
|
|
...
|
2015-12-07 15:19:40 -05:00
|
|
|
"persistent" : {},
|
|
|
|
"transient" : {}
|
|
|
|
}
|
2015-12-09 06:24:40 -05:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
// TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
|
2015-12-09 06:24:40 -05:00
|
|
|
|
2019-08-13 08:22:36 -04:00
|
|
|
|
2018-07-26 11:15:10 -04:00
|
|
|
You can also reset settings using wildcards. For example, to reset
|
|
|
|
all dynamic `indices.recovery` settings:
|
2015-12-09 06:24:40 -05:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2015-12-09 06:24:40 -05:00
|
|
|
--------------------------------------------------
|
2017-02-10 17:57:43 -05:00
|
|
|
PUT /_cluster/settings
|
|
|
|
{
|
2015-12-09 06:24:40 -05:00
|
|
|
"transient" : {
|
2017-02-10 17:57:43 -05:00
|
|
|
"indices.recovery.*" : null
|
2015-12-09 06:24:40 -05:00
|
|
|
}
|
2017-02-10 17:57:43 -05:00
|
|
|
}
|
2015-12-09 06:24:40 -05:00
|
|
|
--------------------------------------------------
|