Add cluster settings API, nitpick formatting

This commit is contained in:
aetter 2021-06-18 11:48:34 -07:00
parent 70837a3f9e
commit 8702fa875b
5 changed files with 102 additions and 17 deletions

View File

@ -11,7 +11,7 @@ Most OpenSearch configuration can take place in the cluster settings API. Certai
Whenever possible, use the cluster settings API instead; `opensearch.yml` is local to each node, whereas the API applies the setting to all nodes in the cluster. Certain settings, however, require `opensearch.yml`. In general, these settings relate to networking, cluster formation, and the local file system. To learn more, see [Cluster formation]({{site.url}}{{site.baseurl}}/opensearch/cluster/). Whenever possible, use the cluster settings API instead; `opensearch.yml` is local to each node, whereas the API applies the setting to all nodes in the cluster. Certain settings, however, require `opensearch.yml`. In general, these settings relate to networking, cluster formation, and the local file system. To learn more, see [Cluster formation]({{site.url}}{{site.baseurl}}/opensearch/cluster/).
## Cluster settings API ## Update cluster settings using the API
The first step in changing a setting is to view the current settings: The first step in changing a setting is to view the current settings:
@ -37,7 +37,7 @@ If you specify the same setting in multiple places, OpenSearch uses the followin
To change a setting, just specify the new one as either persistent or transient. This example shows the flat settings form: To change a setting, just specify the new one as either persistent or transient. This example shows the flat settings form:
```json ```json
PUT /_cluster/settings PUT _cluster/settings
{ {
"persistent" : { "persistent" : {
"action.auto_create_index" : false "action.auto_create_index" : false
@ -48,7 +48,7 @@ PUT /_cluster/settings
You can also use the expanded form, which lets you copy and paste from the GET response and change existing values: You can also use the expanded form, which lets you copy and paste from the GET response and change existing values:
```json ```json
PUT /_cluster/settings PUT _cluster/settings
{ {
"persistent": { "persistent": {
"action": { "action": {

View File

@ -15,7 +15,7 @@ If you add some options, you can instead get information on a specific shard, in
## Example ## Example
```json ```json
GET /_cluster/allocation/explain?include_yes_decisions=true GET _cluster/allocation/explain?include_yes_decisions=true
{ {
"index": "movies", "index": "movies",
"shard": 0, "shard": 0,

View File

@ -16,7 +16,7 @@ To get the status of a specific index, provide the index name.
This request waits 50 seconds for the cluster to reach the yellow status or better: This request waits 50 seconds for the cluster to reach the yellow status or better:
``` ```
GET /_cluster/health?wait_for_status=yellow&timeout=50s GET _cluster/health?wait_for_status=yellow&timeout=50s
``` ```
If the cluster health becomes yellow or green before 50 seconds elapse, it returns a response immediately. Otherwise it returns a response as soon as it exceeds the timeout. If the cluster health becomes yellow or green before 50 seconds elapse, it returns a response immediately. Otherwise it returns a response as soon as it exceeds the timeout.
@ -24,8 +24,8 @@ If the cluster health becomes yellow or green before 50 seconds elapse, it retur
## Path and HTTP methods ## Path and HTTP methods
``` ```
GET /_cluster/health GET _cluster/health
GET /_cluster/health/<index> GET _cluster/health/<index>
``` ```
## URL parameters ## URL parameters
@ -34,16 +34,16 @@ All cluster health parameters are optional.
Parameter | Type | Description Parameter | Type | Description
:--- | :--- | :--- :--- | :--- | :---
expand_wildcards | enum | Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. Default is `open`. expand_wildcards | Enum | Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. Default is `open`.
level | enum | The level of detail for returned health information. Supported values are `cluster`, `indices`, and `shards`. Default is `cluster`. level | Enum | The level of detail for returned health information. Supported values are `cluster`, `indices`, and `shards`. Default is `cluster`.
local | boolean | Whether to return information from the local node only instead of from the master node. Default is false. local | Boolean | Whether to return information from the local node only instead of from the master node. Default is false.
master_timeout | time | The amount of time to wait for a connection to the master node. Default is 30 seconds. master_timeout | Time | The amount of time to wait for a connection to the master node. Default is 30 seconds.
timeout | time | The amount of time to wait for a response. If the timeout expires, the request fails. Default is 30 seconds. timeout | Time | The amount of time to wait for a response. If the timeout expires, the request fails. Default is 30 seconds.
wait_for_active_shards | string | Wait until the specified number of shards is active before returning a response. `all` for all shards. Default is `0`. wait_for_active_shards | String | Wait until the specified number of shards is active before returning a response. `all` for all shards. Default is `0`.
wait_for_events | enum | Wait until all currently queued events with the given priority are processed. Supported values are `immediate`, `urgent`, `high`, `normal`, `low`, and `languid`. wait_for_events | Enum | Wait until all currently queued events with the given priority are processed. Supported values are `immediate`, `urgent`, `high`, `normal`, `low`, and `languid`.
wait_for_no_relocating_shards | boolean | Whether to wait until there are no relocating shards in the cluster. Default is false. wait_for_no_relocating_shards | Boolean | Whether to wait until there are no relocating shards in the cluster. Default is false.
wait_for_no_initializing_shards | boolean | Whether to wait until there are no initializing shards in the cluster. Default is false. wait_for_no_initializing_shards | Boolean | Whether to wait until there are no initializing shards in the cluster. Default is false.
wait_for_status | enum | Wait until the cluster is in a specific state or better. Supported values are `green`, `yellow`, and `red`. wait_for_status | Enum | Wait until the cluster is in a specific state or better. Supported values are `green`, `yellow`, and `red`.
<!-- wait_for_nodes | string | Wait until the specified number of nodes is available. Also supports operators <=, >=, <, and > <!-- wait_for_nodes | string | Wait until the specified number of nodes is available. Also supports operators <=, >=, <, and >
# Not working properly when tested --> # Not working properly when tested -->

View File

@ -0,0 +1,83 @@
---
layout: default
title: Cluster settings
parent: REST API reference
nav_order: 20
---
# Cluster settings
The cluster settings operation lets you check the current settings for your cluster, review default settings, and change settings. When you update a setting using the API, OpenSearch applies it to all nodes in the cluster.
## Examples
```json
GET _cluster/settings?include_defaults=true
```
```json
PUT _cluster/settings
{
"persistent": {
"action": {
"auto_create_index": false
}
}
}
```
## Path and HTTP methods
```
GET _cluster/settings
PUT _cluster/settings
```
## URL parameters
All cluster settings parameters are optional.
Parameter | Type | Description
:--- | :--- | :---
flat_settings | Boolean | Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`.
include_defaults (GET only) | Boolean | Whether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update.
master_timeout | Time | The amount of time to wait for a response from the master node. Default is 30 seconds.
timeout (PUT only) | Time | The amount of time to wait for a response from the cluster. Default is 30 seconds.
## Request body
The GET operation has no request body options.
For a PUT operation, the request body must contain `transient` or `persistent`, along with the setting you want to update:
```json
PUT _cluster/settings
{
"persistent": {
"cluster": {
"max_shards_per_node": 500
}
}
}
```
For more information about transient settings, persistent settings, and precedence, see [OpenSearch configuration]({{site.url}}{{site.baseurl}}/opensearch/configuration/).
## Response
```json
{
"acknowledged": true,
"persistent": {
"cluster": {
"max_shards_per_node": "500"
}
},
"transient": {}
}
```

View File

@ -3,6 +3,8 @@ layout: default
title: Tasks title: Tasks
parent: REST API reference parent: REST API reference
nav_order: 80 nav_order: 80
redirect_from:
- /opensearch/tasksapi/
--- ---
# Tasks # Tasks