update-settings.asciidoc 3.0 KB

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