put-autoscaling-policy.asciidoc 2.2 KB

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