update-settings.asciidoc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. [[cluster-update-settings]]
  2. === Cluster Update Settings
  3. Use this API to review and change cluster-wide settings.
  4. To review cluster settings:
  5. [source,js]
  6. --------------------------------------------------
  7. GET /_cluster/settings
  8. --------------------------------------------------
  9. // CONSOLE
  10. By default, this API call only returns settings that have been explicitly defined, but can also <<cluster-get-settings,include the default settings>>.
  11. Updates to settings can be persistent, meaning they apply across restarts, or transient, where they don't
  12. survive a full cluster restart. Here is an example of a persistent update:
  13. [source,js]
  14. --------------------------------------------------
  15. PUT /_cluster/settings
  16. {
  17. "persistent" : {
  18. "indices.recovery.max_bytes_per_sec" : "50mb"
  19. }
  20. }
  21. --------------------------------------------------
  22. // CONSOLE
  23. This update is transient:
  24. [source,js]
  25. --------------------------------------------------
  26. PUT /_cluster/settings?flat_settings=true
  27. {
  28. "transient" : {
  29. "indices.recovery.max_bytes_per_sec" : "20mb"
  30. }
  31. }
  32. --------------------------------------------------
  33. // CONSOLE
  34. The response to an update returns the changed setting, as in this response to the transient example:
  35. [source,js]
  36. --------------------------------------------------
  37. {
  38. ...
  39. "persistent" : { },
  40. "transient" : {
  41. "indices.recovery.max_bytes_per_sec" : "20mb"
  42. }
  43. }
  44. --------------------------------------------------
  45. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  46. You can reset persistent or transient settings by assigning a
  47. `null` value. If a transient setting is reset, the first one of these values that is defined is applied:
  48. * the persistent setting
  49. * the setting in the configuration file
  50. * the default value.
  51. This example resets a setting:
  52. [source,js]
  53. --------------------------------------------------
  54. PUT /_cluster/settings
  55. {
  56. "transient" : {
  57. "indices.recovery.max_bytes_per_sec" : null
  58. }
  59. }
  60. --------------------------------------------------
  61. // CONSOLE
  62. The response does not include settings that have been reset:
  63. [source,js]
  64. --------------------------------------------------
  65. {
  66. ...
  67. "persistent" : {},
  68. "transient" : {}
  69. }
  70. --------------------------------------------------
  71. // TESTRESPONSE[s/\.\.\./"acknowledged": true,/]
  72. You can also reset settings using wildcards. For example, to reset
  73. all dynamic `indices.recovery` settings:
  74. [source,js]
  75. --------------------------------------------------
  76. PUT /_cluster/settings
  77. {
  78. "transient" : {
  79. "indices.recovery.*" : null
  80. }
  81. }
  82. --------------------------------------------------
  83. // CONSOLE
  84. [float]
  85. ==== Order of Precedence
  86. The order of precedence for cluster settings is:
  87. 1. transient cluster settings
  88. 2. persistent cluster settings
  89. 3. settings in the `elasticsearch.yml` configuration file.
  90. It's best to set all cluster-wide settings with the `settings` API and use the
  91. `elasticsearch.yml` file only for local configurations. This way you can be sure that
  92. the setting is the same on all nodes. If, on the other hand, you define different
  93. settings on different nodes by accident using the configuration file, it is very
  94. difficult to notice these discrepancies.
  95. You can find the list of settings that you can dynamically update in <<modules,Modules>>.