update-settings.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [[cluster-update-settings]]
  2. === Cluster update settings API
  3. ++++
  4. <titleabbrev>Cluster update settings</titleabbrev>
  5. ++++
  6. Updates cluster-wide settings.
  7. [[cluster-update-settings-api-request]]
  8. ==== {api-request-title}
  9. `PUT /_cluster/settings`
  10. [[cluster-update-settings-api-desc]]
  11. ==== {api-description-title}
  12. With specifications in the request body, this API call can update cluster
  13. settings. Updates to settings can be persistent, meaning they apply across
  14. restarts, or transient, where they don't survive a full cluster restart.
  15. You can reset persistent or transient settings by assigning a `null` value. If a
  16. transient setting is reset, the first one of these values that is defined is
  17. applied:
  18. * the persistent setting
  19. * the setting in the configuration file
  20. * the default value.
  21. The order of precedence for cluster settings is:
  22. 1. transient cluster settings
  23. 2. persistent cluster settings
  24. 3. settings in the `elasticsearch.yml` configuration file.
  25. It's best to set all cluster-wide settings with the `settings` API and use the
  26. `elasticsearch.yml` file only for local configurations. This way you can be sure that
  27. the setting is the same on all nodes. If, on the other hand, you define different
  28. settings on different nodes by accident using the configuration file, it is very
  29. difficult to notice these discrepancies.
  30. [[cluster-update-settings-api-query-params]]
  31. ==== {api-query-parms-title}
  32. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
  33. `include_defaults`::
  34. (Optional, boolean) If `true`, returns all default cluster settings.
  35. Defaults to `false`.
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  37. [[cluster-update-settings-api-example]]
  38. ==== {api-examples-title}
  39. An example of a persistent update:
  40. [source,console]
  41. --------------------------------------------------
  42. PUT /_cluster/settings
  43. {
  44. "persistent" : {
  45. "indices.recovery.max_bytes_per_sec" : "50mb"
  46. }
  47. }
  48. --------------------------------------------------
  49. An example of a transient update:
  50. [source,console]
  51. --------------------------------------------------
  52. PUT /_cluster/settings?flat_settings=true
  53. {
  54. "transient" : {
  55. "indices.recovery.max_bytes_per_sec" : "20mb"
  56. }
  57. }
  58. --------------------------------------------------
  59. The response to an update returns the changed setting, as in this response to
  60. the transient example:
  61. [source,console-result]
  62. --------------------------------------------------
  63. {
  64. ...
  65. "persistent" : { },
  66. "transient" : {
  67. "indices.recovery.max_bytes_per_sec" : "20mb"
  68. }
  69. }
  70. --------------------------------------------------
  71. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  72. This example resets a setting:
  73. [source,console]
  74. --------------------------------------------------
  75. PUT /_cluster/settings
  76. {
  77. "transient" : {
  78. "indices.recovery.max_bytes_per_sec" : null
  79. }
  80. }
  81. --------------------------------------------------
  82. The response does not include settings that have been reset:
  83. [source,console-result]
  84. --------------------------------------------------
  85. {
  86. ...
  87. "persistent" : {},
  88. "transient" : {}
  89. }
  90. --------------------------------------------------
  91. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  92. You can also reset settings using wildcards. For example, to reset
  93. all dynamic `indices.recovery` settings:
  94. [source,console]
  95. --------------------------------------------------
  96. PUT /_cluster/settings
  97. {
  98. "transient" : {
  99. "indices.recovery.*" : null
  100. }
  101. }
  102. --------------------------------------------------