You're viewing version 3.5 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.
Query Insights Settings API
Introduced 3.5
The Query Insights Settings API allows you to manage query insights configuration through dedicated endpoints. Use this API to configure top N query monitoring, grouping, and exporter settings with granular, setting-level access control.
This API is functionally equivalent to the Cluster Settings API for query insights configuration. For production environments, you can use the dedicated permission cluster:admin/opensearch/insights/settings/* to grant performance engineers or monitoring teams access only to query insights settings, without exposing all cluster settings.
The API provides the following endpoints:
Retrieve query insights settings
Retrieves all query insights settings, including latency, CPU, memory, grouping, and exporter configurations.
Endpoints
GET /_insights/settings
GET /_insights/settings/{metric_type}
Path parameters
The following table lists the available path parameters. All path parameters are optional.
| Parameter | Data type | Description |
|---|---|---|
metric_type | String | The specific metric type to retrieve settings for. Valid values are latency, cpu, and memory. If omitted, settings for all metrics are returned. |
Example request
GET /_insights/settings/
Example response
{
"persistent": {
"latency": {
"enabled": true,
"top_n_size": 10,
"window_size": "5m"
},
"cpu": {
"enabled": true,
"top_n_size": 10,
"window_size": "5m"
},
"memory": {
"enabled": true,
"top_n_size": 10,
"window_size": "5m"
},
"grouping": {
"group_by": "none"
},
"exporter": {
"type": "local_index",
"delete_after_days": 7
}
}
}
Response body fields
The following table lists all response body fields.
| Field | Data type | Description |
|---|---|---|
persistent | Object | Contains the persistent cluster settings for query insights. |
persistent.latency | Object | Latency metric configuration settings. |
persistent.latency.enabled | Boolean | Whether top N query monitoring for latency is enabled. |
persistent.latency.top_n_size | Integer | The number of top queries being tracked for latency. |
persistent.latency.window_size | String | The time window for collecting top latency queries. |
persistent.cpu | Object | CPU metric configuration settings. |
persistent.cpu.enabled | Boolean | Whether top N query monitoring for CPU is enabled. |
persistent.cpu.top_n_size | Integer | The number of top queries being tracked for CPU. |
persistent.cpu.window_size | String | The time window for collecting top CPU queries. |
persistent.memory | Object | Memory metric configuration settings. |
persistent.memory.enabled | Boolean | Whether top N query monitoring for memory is enabled. |
persistent.memory.top_n_size | Integer | The number of top queries being tracked for memory. |
persistent.memory.window_size | String | The time window for collecting top memory queries. |
persistent.grouping | Object | Query grouping configuration settings. |
persistent.grouping.group_by | String | The method for grouping similar queries. |
persistent.exporter | Object | Exporter configuration settings. |
persistent.exporter.type | String | The exporter type for top N query data. |
persistent.exporter.delete_after_days | Integer | The number of days to retain local index data when using the local_index exporter. |
Update query insights settings
Updates query insights settings. You can update settings for one or more metrics in a single request.
Endpoint
PUT /_insights/settings
Request body fields
The following table lists the available request body fields.
| Field | Data type | Description |
|---|---|---|
latency | Object | Latency metric configuration. Optional. |
latency.enabled | Boolean | Enable or disable top N query monitoring for latency. Optional. Default is true. |
latency.top_n_size | Integer | The number of top queries to track for latency. Valid values are 1–100. Optional. Default is 10. |
latency.window_size | String | The time window for collecting top latency queries. Valid values: 1m, 5m, 10m, 30m, 1h. Optional. Default is 5m. |
cpu | Object | CPU metric configuration. Optional. |
cpu.enabled | Boolean | Enable or disable top N query monitoring for CPU. Optional. Default is false. |
cpu.top_n_size | Integer | The number of top queries to track for CPU. Valid values are 1–100. Optional. Default is 10. |
cpu.window_size | String | The time window for collecting top CPU queries. Valid values: 1m, 5m, 10m, 30m, 1h. Optional. Default is 5m. |
memory | Object | Memory metric configuration. Optional. |
memory.enabled | Boolean | Enable or disable top N query monitoring for memory. Optional. Default is false. |
memory.top_n_size | Integer | The number of top queries to track for memory. Valid values are 1–100. Optional. Default is 10. |
memory.window_size | String | The time window for collecting top memory queries. Valid values: 1m, 5m, 10m, 30m, 1h. Optional. Default is 5m. |
grouping | Object | Query grouping configuration. Optional. |
grouping.group_by | String | The method for grouping similar queries. Valid values are similarity and none. Optional. Default is none. |
exporter | Object | Exporter configuration. Optional. |
exporter.type | String | The exporter type for top N query data. Valid values are local_index and debug. Optional. Default is local_index. |
exporter.delete_after_days | Integer | The number of days to retain local index data (1–180). Applies only when type is local_index. Optional. Default is 7. |
For more information about metric settings, see Top N queries.
For more information about query grouping, see Grouping top N queries.
For more information about exporters, see Exporting top N query data.
Example request: Updating latency settings
PUT /_insights/settings
{
"latency": {
"enabled": true,
"top_n_size": 20,
"window_size": "10m"
}
}
Example request: Updating multiple metric settings
PUT /_insights/settings
{
"latency": {
"enabled": true,
"top_n_size": 15
},
"cpu": {
"enabled": true,
"top_n_size": 10,
"window_size": "10m"
},
"memory": {
"enabled": false
}
}
Example request: Updating grouping settings
PUT /_insights/settings
{
"grouping": {
"group_by": "similarity"
}
}
Example request: Updating exporter settings
PUT /_insights/settings
{
"exporter": {
"type": "local_index",
"delete_after_days": 7
}
}
Required permissions
If you use the Security plugin, make sure you have the appropriate permissions:
cluster:admin/opensearch/insights/settings/getfor GET requestscluster:admin/opensearch/insights/settings/updatefor PUT requestscluster:admin/opensearch/insights/settings/*for all query insights settings API operations
You can configure these permissions in your Security plugin or access control system.
For production deployments, consider creating a dedicated role with access only to these endpoints rather than granting full cluster settings permissions.