|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Query group lifecycle API |
| 4 | +nav_order: 20 |
| 5 | +parent: Workload management |
| 6 | +grand_parent: Availability and recovery |
| 7 | +--- |
| 8 | + |
| 9 | +# Query Group Lifecycle API |
| 10 | + |
| 11 | +The Query Group Lifecycle API in creates, updates, retrieves, and deletes query groups. The API categorizes queries into specific groups, called _query groups_ based on desired resource limits. |
| 12 | + |
| 13 | +## Paths and HTTP method |
| 14 | + |
| 15 | +```json |
| 16 | +PUT _wlm/query_group |
| 17 | +PUT _wlm/query_group/<name> |
| 18 | +GET _wlm/query_group |
| 19 | +GET _wlm/query_group/<name> |
| 20 | +DELETE _wlm/query_group/<name> |
| 21 | +``` |
| 22 | + |
| 23 | +## Request body fields |
| 24 | + |
| 25 | +| Field | Description | |
| 26 | +| :--- | :--- | |
| 27 | +| `_id` | The ID of the query group, which can be used to associate query requests with the group and enforce the group's resource limits. | |
| 28 | +| `name` | The name of the query group. | |
| 29 | +| `resiliency_mode` | The resiliency mode of the query group. Valid modes are `enforced`, `soft`, and `monitor`. For more information about resiliency modes, see [Operating modes](https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/workload-management/wlm-feature-overview/#operating-modes). | |
| 30 | +| `resource_limits` | The resource limits for query requests in the query group. Valid resources are `cpu` and `memory`. | |
| 31 | + |
| 32 | +When creating a query group, make sure that the sum of the resource limits for a single resource, either `cpu` or `memory`, does not exceed 1. |
| 33 | + |
| 34 | +## Example requests |
| 35 | + |
| 36 | +The following requests show how to use the Query Group Lifecycle API. |
| 37 | + |
| 38 | +### Creating a query group |
| 39 | + |
| 40 | +```json |
| 41 | +PUT _wlm/query_group |
| 42 | +{ |
| 43 | + "name": "analytics", |
| 44 | + "resiliency_mode": "enforced", |
| 45 | + "resource_limits": { |
| 46 | + "cpu": 0.4, |
| 47 | + "memory": 0.2 |
| 48 | + } |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### Updating a query group |
| 53 | + |
| 54 | +```json |
| 55 | +PUT _wlm/query_group/analytics |
| 56 | +{ |
| 57 | + "resiliency_mode": "monitor", |
| 58 | + "resource_limits": { |
| 59 | + "cpu": 0.41, |
| 60 | + "memory": 0.21 |
| 61 | + } |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +### Getting a query group |
| 66 | + |
| 67 | +```json |
| 68 | +GET _wlm/query_group/analytics |
| 69 | +``` |
| 70 | + |
| 71 | +### Deleting a query group |
| 72 | + |
| 73 | +```json |
| 74 | +DELETE _wlm/query_group/analytics |
| 75 | +``` |
| 76 | + |
| 77 | +## Example responses |
| 78 | + |
| 79 | +OpenSearch returns responses similar to the following. |
| 80 | + |
| 81 | +### Creating a query group |
| 82 | + |
| 83 | +```json |
| 84 | +{ |
| 85 | + "_id":"preXpc67RbKKeCyka72_Gw", |
| 86 | + "name":"analytics", |
| 87 | + "resiliency_mode":"enforced", |
| 88 | + "resource_limits":{ |
| 89 | + "cpu":0.4, |
| 90 | + "memory":0.2 |
| 91 | + }, |
| 92 | + "updated_at":1726270184642 |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### Updating query group |
| 97 | + |
| 98 | +```json |
| 99 | +{ |
| 100 | + "_id":"preXpc67RbKKeCyka72_Gw", |
| 101 | + "name":"analytics", |
| 102 | + "resiliency_mode":"monitor", |
| 103 | + "resource_limits":{ |
| 104 | + "cpu":0.41, |
| 105 | + "memory":0.21 |
| 106 | + }, |
| 107 | + "updated_at":1726270333804 |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +## Response body fields |
| 112 | + |
| 113 | +| Field | Description | |
| 114 | +| :--- | :--- | |
| 115 | +| `_id` | The ID of the query group. | |
| 116 | +| `name` | The name of the query group. Required when creating a new query group. | |
| 117 | +| `resiliency_mode` | The resiliency mode of the query group. | |
| 118 | +| `resource_limits` | The resource limits of the query group. | |
| 119 | +| `updated_at` | The time at which the query group was last updated. | |
| 120 | + |
| 121 | + |
0 commit comments