update-settings.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. [[cluster-update-settings]]
  2. == Cluster Update Settings
  3. Allows to update cluster wide specific settings. Settings updated can
  4. either be persistent (applied cross restarts) or transient (will not
  5. survive a full cluster restart). Here is an example:
  6. [source,js]
  7. --------------------------------------------------
  8. PUT /_cluster/settings
  9. {
  10. "persistent" : {
  11. "indices.recovery.max_bytes_per_sec" : "50mb"
  12. }
  13. }
  14. --------------------------------------------------
  15. // CONSOLE
  16. Or:
  17. [source,js]
  18. --------------------------------------------------
  19. PUT /_cluster/settings?flat_settings=true
  20. {
  21. "transient" : {
  22. "indices.recovery.max_bytes_per_sec" : "20mb"
  23. }
  24. }
  25. --------------------------------------------------
  26. // CONSOLE
  27. The cluster responds with the settings updated. So the response for the
  28. last example will be:
  29. [source,js]
  30. --------------------------------------------------
  31. {
  32. ...
  33. "persistent" : { },
  34. "transient" : {
  35. "indices.recovery.max_bytes_per_sec" : "20mb"
  36. }
  37. }
  38. --------------------------------------------------
  39. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  40. Resetting persistent or transient settings can be done by assigning a
  41. `null` value. If a transient setting is reset, the persistent setting
  42. is applied if available. Otherwise Elasticsearch will fallback to the setting
  43. defined at the configuration file or, if not existent, to the default
  44. value. Here is an example:
  45. [source,js]
  46. --------------------------------------------------
  47. PUT /_cluster/settings
  48. {
  49. "transient" : {
  50. "indices.recovery.max_bytes_per_sec" : null
  51. }
  52. }
  53. --------------------------------------------------
  54. // CONSOLE
  55. Reset settings will not be included in the cluster response. So
  56. the response for the last example will be:
  57. [source,js]
  58. --------------------------------------------------
  59. {
  60. ...
  61. "persistent" : {},
  62. "transient" : {}
  63. }
  64. --------------------------------------------------
  65. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  66. Settings can also be reset using simple wildcards. For instance to reset
  67. all dynamic `indices.recovery` setting a prefix can be used:
  68. [source,js]
  69. --------------------------------------------------
  70. PUT /_cluster/settings
  71. {
  72. "transient" : {
  73. "indices.recovery.*" : null
  74. }
  75. }
  76. --------------------------------------------------
  77. // CONSOLE
  78. Cluster wide settings can be returned using:
  79. [source,js]
  80. --------------------------------------------------
  81. GET /_cluster/settings
  82. --------------------------------------------------
  83. // CONSOLE
  84. [float]
  85. === Precedence of settings
  86. Transient cluster settings take precedence over persistent cluster settings,
  87. which take precedence over settings configured in the `elasticsearch.yml`
  88. config file.
  89. For this reason it is preferrable to use the `elasticsearch.yml` file only
  90. for local configurations, and set all cluster-wider settings with the
  91. `settings` API.
  92. A list of dynamically updatable settings can be found in the
  93. <<modules,Modules>> documentation.