update-settings.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. NOTE: Transient settings are deprecated and will be removed in a future release.
  35. Use persistent cluster settings instead.
  36. [source,console]
  37. --------------------------------------------------
  38. PUT /_cluster/settings?flat_settings=true
  39. {
  40. "transient" : {
  41. "indices.recovery.max_bytes_per_sec" : "20mb"
  42. }
  43. }
  44. --------------------------------------------------
  45. // TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
  46. The response to an update returns the changed setting, as in this response to
  47. the transient example:
  48. [source,console-result]
  49. --------------------------------------------------
  50. {
  51. ...
  52. "persistent" : { },
  53. "transient" : {
  54. "indices.recovery.max_bytes_per_sec" : "20mb"
  55. }
  56. }
  57. --------------------------------------------------
  58. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  59. This example resets a setting:
  60. [source,console]
  61. --------------------------------------------------
  62. PUT /_cluster/settings
  63. {
  64. "transient" : {
  65. "indices.recovery.max_bytes_per_sec" : null
  66. }
  67. }
  68. --------------------------------------------------
  69. // TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]
  70. The response does not include settings that have been reset:
  71. [source,console-result]
  72. --------------------------------------------------
  73. {
  74. ...
  75. "persistent" : {},
  76. "transient" : {}
  77. }
  78. --------------------------------------------------
  79. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  80. You can also reset settings using wildcards. For example, to reset
  81. all dynamic `indices.recovery` settings:
  82. [source,console]
  83. --------------------------------------------------
  84. PUT /_cluster/settings
  85. {
  86. "transient" : {
  87. "indices.recovery.*" : null
  88. }
  89. }
  90. --------------------------------------------------
  91. // TEST[warning:[transient settings removal] Updating cluster settings through transientSettings is deprecated. Use persistent settings instead.]