set-upgrade-mode.asciidoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-set-upgrade-mode]]
  4. === Set upgrade mode API
  5. ++++
  6. <titleabbrev>Set upgrade mode</titleabbrev>
  7. ++++
  8. Sets a cluster wide upgrade_mode setting that prepares {ml} indices for an
  9. upgrade.
  10. ==== Request
  11. //////////////////////////
  12. [source,js]
  13. --------------------------------------------------
  14. POST /_ml/set_upgrade_mode?enabled=false&timeout=10m
  15. --------------------------------------------------
  16. // CONSOLE
  17. // TEST
  18. // TEARDOWN
  19. //////////////////////////
  20. `POST _ml/set_upgrade_mode`
  21. ==== Description
  22. When upgrading your cluster, in some circumstances you must restart your nodes and
  23. reindex your {ml} indices. In those circumstances, there must be no {ml} jobs running.
  24. You can close the {ml} jobs, do the upgrade, then open all the jobs again.
  25. Alternatively, you can use this API to temporarily halt tasks associated
  26. with the jobs and {dfeeds} and prevent new jobs from opening. You can also use this
  27. API during upgrades that do not require you to reindex your {ml} indices,
  28. though stopping jobs is not a requirement in that case.
  29. For more information, see {stack-ref}/upgrading-elastic-stack.html[Upgrading the {stack}].
  30. When `enabled=true` this API temporarily halts all job and {dfeed} tasks and
  31. prohibits new job and {dfeed} tasks from starting.
  32. Subsequently, you can call the API with the enabled parameter set to false,
  33. which causes {ml} jobs and {dfeeds} to return to their desired states.
  34. You can see the current value for the `upgrade_mode` setting by using the
  35. <<get-ml-info,get {ml} info API>>.
  36. IMPORTANT: No new {ml} jobs can be opened while the `upgrade_mode` setting is
  37. `true`.
  38. ==== Query Parameters
  39. `enabled`::
  40. (boolean) When `true`, this enables `upgrade_mode`. Defaults to `false`
  41. `timeout`::
  42. (time) The time to wait for the request to be completed.
  43. The default value is 30 seconds.
  44. ==== Authorization
  45. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  46. For more information, see
  47. {stack-ov}/security-privileges.html[Security privileges].
  48. ==== Examples
  49. The following example enables `upgrade_mode` for the cluster:
  50. [source,js]
  51. --------------------------------------------------
  52. POST _ml/set_upgrade_mode?enabled=true&timeout=10m
  53. --------------------------------------------------
  54. // CONSOLE
  55. // TEST
  56. When the call is successful, an acknowledged response is returned. For example:
  57. [source,js]
  58. ----
  59. {
  60. "acknowledged": true
  61. }
  62. ----
  63. // TESTRESPONSE
  64. The acknowledged response will only be returned once all {ml} jobs and {dfeeds} have
  65. finished writing to the {ml} internal indices. This means it is safe to reindex those
  66. internal indices without causing failures. You must wait for the acknowledged
  67. response before reindexing to ensure that all writes are completed.
  68. When the upgrade is complete, you must set `upgrade_mode` to `false` for
  69. {ml} jobs to start running again. For example:
  70. [source,js]
  71. --------------------------------------------------
  72. POST _ml/set_upgrade_mode?enabled=false&timeout=10m
  73. --------------------------------------------------
  74. // CONSOLE
  75. // TEST