update-settings.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. [[cluster-update-settings]]
  2. === Cluster update settings API
  3. ++++
  4. <titleabbrev>Cluster update settings</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cluster[Cluster APIs].
  10. --
  11. Configures <<dynamic-cluster-setting,dynamic cluster settings>>.
  12. [[cluster-update-settings-api-request]]
  13. ==== {api-request-title}
  14. `PUT /_cluster/settings`
  15. [[cluster-update-settings-api-prereqs]]
  16. ==== {api-prereq-title}
  17. * If the {es} {security-features} are enabled, you must have the `manage`
  18. <<privileges-list-cluster,cluster privilege>> to use this API.
  19. [[cluster-update-settings-api-desc]]
  20. ==== {api-description-title}
  21. :strip-api-link: true
  22. include::{es-ref-dir}/setup/configuration.asciidoc[tag=cluster-setting-precedence]
  23. [[cluster-update-settings-api-query-params]]
  24. ==== {api-query-parms-title}
  25. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
  26. `include_defaults`::
  27. (Optional, Boolean) If `true`, returns all default cluster settings.
  28. Defaults to `false`.
  29. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  30. [[cluster-update-settings-api-example]]
  31. ==== {api-examples-title}
  32. An example of a persistent update:
  33. [source,console]
  34. --------------------------------------------------
  35. PUT /_cluster/settings
  36. {
  37. "persistent" : {
  38. "indices.recovery.max_bytes_per_sec" : "50mb"
  39. }
  40. }
  41. --------------------------------------------------
  42. An example of a transient update:
  43. // tag::transient-settings-warning[]
  44. [WARNING]
  45. ====
  46. We no longer recommend using transient cluster settings. Use persistent cluster
  47. settings instead. If a cluster becomes unstable, transient settings can clear
  48. unexpectedly, resulting in a potentially undesired cluster configuration. See
  49. the <<transient-settings-migration-guide>>.
  50. ====
  51. // end::transient-settings-warning[]
  52. [source,console]
  53. --------------------------------------------------
  54. PUT /_cluster/settings?flat_settings=true
  55. {
  56. "transient" : {
  57. "indices.recovery.max_bytes_per_sec" : "20mb"
  58. }
  59. }
  60. --------------------------------------------------
  61. The response to an update returns the changed setting, as in this response to
  62. the transient example:
  63. [source,console-result]
  64. --------------------------------------------------
  65. {
  66. ...
  67. "persistent" : { },
  68. "transient" : {
  69. "indices.recovery.max_bytes_per_sec" : "20mb"
  70. }
  71. }
  72. --------------------------------------------------
  73. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  74. This example resets a setting:
  75. [source,console]
  76. --------------------------------------------------
  77. PUT /_cluster/settings
  78. {
  79. "transient" : {
  80. "indices.recovery.max_bytes_per_sec" : null
  81. }
  82. }
  83. --------------------------------------------------
  84. The response does not include settings that have been reset:
  85. [source,console-result]
  86. --------------------------------------------------
  87. {
  88. ...
  89. "persistent" : {},
  90. "transient" : {}
  91. }
  92. --------------------------------------------------
  93. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  94. You can also reset settings using wildcards. For example, to reset
  95. all dynamic `indices.recovery` settings:
  96. [source,console]
  97. --------------------------------------------------
  98. PUT /_cluster/settings
  99. {
  100. "transient" : {
  101. "indices.recovery.*" : null
  102. }
  103. }
  104. --------------------------------------------------