put-autoscaling-policy.asciidoc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. [role="xpack"]
  2. [testenv="enterprise"]
  3. [[autoscaling-put-autoscaling-policy]]
  4. === Create or update autoscaling policy API
  5. ++++
  6. <titleabbrev>Create or update autoscaling policy</titleabbrev>
  7. ++++
  8. include::../autoscaling-designed-for-note.asciidoc[]
  9. Creates or updates an autoscaling policy.
  10. [[autoscaling-put-autoscaling-policy-request]]
  11. ==== {api-request-title}
  12. [source,console]
  13. --------------------------------------------------
  14. PUT /_autoscaling/policy/<name>
  15. {
  16. "roles": [],
  17. "deciders": {
  18. "fixed": {
  19. }
  20. }
  21. }
  22. --------------------------------------------------
  23. // TEST[s/<name>/name/]
  24. //////////////////////////
  25. [source,console]
  26. --------------------------------------------------
  27. DELETE /_autoscaling/policy/name
  28. --------------------------------------------------
  29. // TEST[continued]
  30. //////////////////////////
  31. [[autoscaling-put-autoscaling-policy-prereqs]]
  32. ==== {api-prereq-title}
  33. * If the {es} {security-features} are enabled, you must have the
  34. `manage_autoscaling` <<privileges-list-cluster,cluster privilege>> to use this
  35. API.
  36. * If the <<operator-privileges,{operator-feature}>> is enabled, only operator
  37. users can use this API.
  38. [[autoscaling-put-autoscaling-policy-desc]]
  39. ==== {api-description-title}
  40. This API puts an autoscaling policy with the provided name.
  41. See <<autoscaling-deciders,Autoscaling Deciders>> for available deciders.
  42. [[autoscaling-put-autoscaling-policy-examples]]
  43. ==== {api-examples-title}
  44. This example puts an autoscaling policy named `my_autoscaling_policy` using the
  45. fixed autoscaling decider, applying to the set of nodes having (only) the
  46. "data_hot" role.
  47. [source,console]
  48. --------------------------------------------------
  49. PUT /_autoscaling/policy/my_autoscaling_policy
  50. {
  51. "roles" : [ "data_hot" ],
  52. "deciders": {
  53. "fixed": {
  54. }
  55. }
  56. }
  57. --------------------------------------------------
  58. // TEST
  59. The API returns the following result:
  60. [source,console-result]
  61. --------------------------------------------------
  62. {
  63. "acknowledged": true
  64. }
  65. --------------------------------------------------
  66. //////////////////////////
  67. [source,console]
  68. --------------------------------------------------
  69. DELETE /_autoscaling/policy/my_autoscaling_policy
  70. --------------------------------------------------
  71. // TEST[continued]
  72. //////////////////////////