2020-04-01 19:35:45 +08:00
|
|
|
[role="xpack"]
|
2021-01-13 05:03:18 +08:00
|
|
|
[testenv="enterprise"]
|
2020-04-01 19:35:45 +08:00
|
|
|
[[autoscaling-put-autoscaling-policy]]
|
2021-03-16 02:49:44 +08:00
|
|
|
=== Create or update autoscaling policy API
|
2020-04-01 19:35:45 +08:00
|
|
|
++++
|
2021-03-16 02:49:44 +08:00
|
|
|
<titleabbrev>Create or update autoscaling policy</titleabbrev>
|
2020-04-01 19:35:45 +08:00
|
|
|
++++
|
|
|
|
|
2021-03-25 21:21:35 +08:00
|
|
|
NOTE: {cloud-only}
|
2020-12-15 02:06:09 +08:00
|
|
|
|
2021-03-16 02:49:44 +08:00
|
|
|
Creates or updates an autoscaling policy.
|
2020-04-01 19:35:45 +08:00
|
|
|
|
|
|
|
[[autoscaling-put-autoscaling-policy-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
PUT /_autoscaling/policy/<name>
|
|
|
|
{
|
2020-11-02 14:30:31 +08:00
|
|
|
"roles": [],
|
|
|
|
"deciders": {
|
|
|
|
"fixed": {
|
2020-04-01 19:35:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[s/<name>/name/]
|
|
|
|
|
2020-08-10 18:02:25 +08:00
|
|
|
//////////////////////////
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
DELETE /_autoscaling/policy/name
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
2020-04-01 19:35:45 +08:00
|
|
|
[[autoscaling-put-autoscaling-policy-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
2021-03-15 21:20:09 +08:00
|
|
|
* If the {es} {security-features} are enabled, you must have the
|
|
|
|
`manage_autoscaling` <<privileges-list-cluster,cluster privilege>> to use this
|
|
|
|
API.
|
|
|
|
|
|
|
|
* If the <<operator-privileges,{operator-feature}>> is enabled, only operator
|
|
|
|
users can use this API.
|
2020-04-01 19:35:45 +08:00
|
|
|
|
|
|
|
[[autoscaling-put-autoscaling-policy-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
This API puts an autoscaling policy with the provided name.
|
2021-01-13 05:03:18 +08:00
|
|
|
See <<autoscaling-deciders,Autoscaling Deciders>> for available deciders.
|
2020-04-01 19:35:45 +08:00
|
|
|
|
|
|
|
[[autoscaling-put-autoscaling-policy-examples]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
2020-04-02 04:30:26 +08:00
|
|
|
This example puts an autoscaling policy named `my_autoscaling_policy` using the
|
2020-11-02 14:30:31 +08:00
|
|
|
fixed autoscaling decider, applying to the set of nodes having (only) the
|
|
|
|
"data_hot" role.
|
2020-04-01 19:35:45 +08:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
2020-04-02 04:30:26 +08:00
|
|
|
PUT /_autoscaling/policy/my_autoscaling_policy
|
2020-04-01 19:35:45 +08:00
|
|
|
{
|
2020-11-02 14:30:31 +08:00
|
|
|
"roles" : [ "data_hot" ],
|
|
|
|
"deciders": {
|
|
|
|
"fixed": {
|
2020-04-01 19:35:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST
|
|
|
|
|
|
|
|
The API returns the following result:
|
|
|
|
|
|
|
|
[source,console-result]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"acknowledged": true
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2020-08-10 18:02:25 +08:00
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
DELETE /_autoscaling/policy/my_autoscaling_policy
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
//////////////////////////
|