You're viewing version 3.2 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.
Workload groups
A workload group is a logical grouping of tasks with defined resource limits. You can create, update, retrieve, and delete workload groups using the Workload Group API.
Creating a workload group
To create a workload group, send the following request:
PUT _wlm/workload_group
{
"name": "analytics",
"resiliency_mode": "enforced",
"resource_limits": {
"cpu": 0.4,
"memory": 0.2
}
}
OpenSearch returns a response containing a workload group ID, which can be used to associate query requests with the group and enforce the group’s resource limits:
{
"_id":"preXpc67RbKKeCyka72_Gw",
"name":"analytics",
"resiliency_mode":"enforced",
"resource_limits":{
"cpu":0.4,
"memory":0.2
},
"updated_at":1726270184642
}
For more information, see Using the workload group ID.
Parameters
When creating or updating a workload group, you can specify the following parameters.
| Parameter | Operation | Description |
|---|---|---|
name | Create | The name of the workload group. |
resiliency_mode | Create or update | The resiliency mode of the workload group. Valid values are: - enforced (queries are rejected if thresholds are exceeded). - soft (queries can exceed thresholds if resources are available). - monitor (queries are monitored but not canceled or rejected). Note: These settings take effect only if the cluster-level wlm.workload_group.mode setting is enabled. See Operating modes. |
resource_limits | Create or update | The resource limits for query requests in the workload group. Valid resources are cpu and memory. When creating a workload group, make sure that the sum of the resource limits for a single resource, either cpu or memory, does not exceed 1. |
Updating a workload group
To update a workload group, provide the workload group name as a path parameter and the parameters that you want to update as request body fields. When you update a workload group, only the parameters you specify are changed; all others stay the same:
PUT _wlm/workload_group/analytics
{
"resiliency_mode": "monitor",
"resource_limits": {
"cpu": 0.41,
"memory": 0.21
}
}
Retrieving a workload group
To retrieve all workload groups, use the following request:
GET /_wlm/workload_group
To retrieve a specific workload group, provide its ID as a path parameter:
GET /_wlm/workload_group/{name}
Deleting a workload group
To delete a workload group, specify its name as a path parameter:
DELETE /_wlm/query_group/{name}