update-settings.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. curl -XPUT localhost:9200/_cluster/settings -d '{
  9. "persistent" : {
  10. "discovery.zen.minimum_master_nodes" : 2
  11. }
  12. }'
  13. --------------------------------------------------
  14. Or:
  15. [source,js]
  16. --------------------------------------------------
  17. curl -XPUT localhost:9200/_cluster/settings -d '{
  18. "transient" : {
  19. "discovery.zen.minimum_master_nodes" : 2
  20. }
  21. }'
  22. --------------------------------------------------
  23. The cluster responds with the settings updated. So the response for the
  24. last example will be:
  25. [source,js]
  26. --------------------------------------------------
  27. {
  28. "persistent" : {},
  29. "transient" : {
  30. "discovery.zen.minimum_master_nodes" : "2"
  31. }
  32. }'
  33. --------------------------------------------------
  34. Resetting persistent or transient settings can be done by assigning a
  35. `null` value. If a transient setting is reset, the persistent setting
  36. is applied if available. Otherwise Elasticsearch will fallback to the setting
  37. defined at the configuration file or, if not existent, to the default
  38. value. Here is an example:
  39. [source,js]
  40. --------------------------------------------------
  41. curl -XPUT localhost:9200/_cluster/settings -d '{
  42. "transient" : {
  43. "discovery.zen.minimum_master_nodes" : null
  44. }
  45. }'
  46. --------------------------------------------------
  47. Reset settings will not be included in the cluster response. So
  48. the response for the last example will be:
  49. [source,js]
  50. --------------------------------------------------
  51. {
  52. "persistent" : {},
  53. "transient" : {}
  54. }
  55. --------------------------------------------------
  56. Settings can also be reset using simple wildcards. For instance to reset
  57. all dynamic `discovery.zen` setting a prefix can be used:
  58. [source,js]
  59. --------------------------------------------------
  60. curl -XPUT localhost:9200/_cluster/settings -d '{
  61. "transient" : {
  62. "discovery.zen.*" : null
  63. }
  64. }'
  65. --------------------------------------------------
  66. Cluster wide settings can be returned using:
  67. [source,js]
  68. --------------------------------------------------
  69. curl -XGET localhost:9200/_cluster/settings
  70. --------------------------------------------------
  71. [float]
  72. === Precedence of settings
  73. Transient cluster settings take precedence over persistent cluster settings,
  74. which take precedence over settings configured in the `elasticsearch.yml`
  75. config file.
  76. For this reason it is preferrable to use the `elasticsearch.yml` file only
  77. for local configurations, and set all cluster-wider settings with the
  78. `settings` API.
  79. A list of dynamically updatable settings can be found in the
  80. <<modules,Modules>> documentation.