Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markers for cluster APIs. #9110

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
31 changes: 21 additions & 10 deletions _api-reference/cluster-api/cluster-allocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,37 @@ redirect_from:
**Introduced 1.0**
{: .label .label-purple }

The most basic cluster allocation explain request finds an unassigned shard and explains why it can't be allocated to a node.
The Cluster allocation explain API gives an explanation for how shards are allocated in the current cluster and provides an explanation for why unassigned shards can't be allocated to a node.

If you add some options, you can instead get information on a specific shard, including why OpenSearch assigned it to its current node.


<!-- spec_insert_start
api: cluster.allocation_explain
component: endpoints
-->
## Endpoints

```json
GET _cluster/allocation/explain
POST _cluster/allocation/explain
GET /_cluster/allocation/explain
POST /_cluster/allocation/explain
```
<!-- spec_insert_end -->


<!-- spec_insert_start
api: cluster.allocation_explain
columns: Parameter, Data type, Description, Default
component: query_parameters
-->
## Query parameters

All parameters are optional.
The following table lists the available query parameters. All query parameters are optional.

Parameter | Type | Description
:--- | :--- | :---
include_yes_decisions | Boolean | OpenSearch makes a series of yes or no decisions when trying to allocate a shard to a node. If this parameter is true, OpenSearch includes the (generally more numerous) "yes" decisions in its response. Default is `false`.
include_disk_info | Boolean | Whether to include information about disk usage in the response. Default is `false`.
| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
| `include_disk_info` | Boolean | When `true`, returns information about disk usage and shard sizes. | `false` |
| `include_yes_decisions` | Boolean | When `true`, returns any `YES` decisions in the allocation explanation. | `false` |

<!-- spec_insert_end -->


## Request body fields
Expand Down
37 changes: 30 additions & 7 deletions _api-reference/cluster-api/cluster-awareness.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,42 @@ redirect_from:

To control the distribution of search or HTTP traffic, you can use the weights per awareness attribute to control the distribution of search or HTTP traffic across zones. This is commonly used for zonal deployments, heterogeneous instances, and routing traffic away from zones during zonal failure.

<!-- spec_insert_start
api: cluster.get_weighted_routing
component: endpoints
-->
## Endpoints
```json
GET /_cluster/routing/awareness/{attribute}/weights
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.put_weighted_routing
component: endpoints
omit_header: true
-->
```json
PUT /_cluster/routing/awareness/<attribute>/weights
GET /_cluster/routing/awareness/<attribute>/weights?local
GET /_cluster/routing/awareness/<attribute>/weights
PUT /_cluster/routing/awareness/{attribute}/weights
```
<!-- spec_insert_end -->

## Path parameters
<!-- spec_insert_start
api: cluster.allocation_explain
columns: Parameter, Data type, Description, Default
component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
| `include_disk_info` | Boolean | When `true`, returns information about disk usage and shard sizes. | `false` |
| `include_yes_decisions` | Boolean | When `true`, returns any `YES` decisions in the allocation explanation. | `false` |

<!-- spec_insert_end -->

Parameter | Type | Description
:--- | :--- | :---
attribute | String | The name of the awareness attribute, usually `zone`. The attribute name must match the values listed in the request body when assigning weights to zones.

## Request body fields

Expand Down
142 changes: 142 additions & 0 deletions _api-reference/cluster-api/cluster-component-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
layout: default
title: Cluster component template
nav_order: 25
parent: Cluster APIs
---

# Cluster component template
**Introduced 1.0**
{: .label .label-purple }

The Cluster component template APIs creates and updates the cluster's component templates

# Endpoints

The `GET` method returns one or more component templates.

<!-- spec_insert_start
api: cluster.get_component_template
component: endpoints
omit_header: true
-->
```json
GET /_component_template
GET /_component_template/{name}
```
<!-- spec_insert_end -->

The `EXISTS` method returns information about whether a particular component template exist.

<!-- spec_insert_start
api: cluster.exists_component_template
component: endpoints
omit_header: true
-->
```json
HEAD /_component_template/{name}
```
<!-- spec_insert_end -->

The `PUT` method creates or updates a component template.

<!-- spec_insert_start
api: cluster.put_component_template
component: endpoints
omit_header: true
-->
```json
POST /_component_template/{name}
PUT /_component_template/{name}
```
<!-- spec_insert_end -->

The `DELETE` method deletes a component template.

<!-- spec_insert_start
api: cluster.delete_component_template
component: endpoints
omit_header: true
-->
```json
DELETE /_component_template/{name}
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.put_component_template
component: path_parameters
-->
## Path parameters

The following table lists the available path parameters.

| Parameter | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `name` | **Required** | String | The name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`; 'logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. OpenSearch uses these templates to configure backing indexes for its data streams. If you want to overwrite one of these templates, set the replacement template `version` to a higher value than the current version. If you want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the Cluster Update Settings API. |

<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.put_component_template
columns: Parameter, Data type, Description, Default
component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
| `cluster_manager_timeout` | String | A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |
| `create` | Boolean | When `true`, this request cannot replace or update existing component templates. | `false` |
| `timeout` | String | A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |
| `master_timeout` <br> _DEPRECATED_ | String | _(Deprecated since 2.0: To promote inclusive language, use `cluster_manager_timeout` instead.)_ A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |

<!-- spec_insert_end -->

## Example request

```json
POST /_component_template/logs_template
{
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"timestamp": {
"type": "date"
},
"message": {
"type": "text"
},
"level": {
"type": "keyword"
},
"service": {
"type": "keyword"
}
}
},
"aliases": {
"logs_alias": {}
}
},
"version": 1,
"meta": {
"description": "Component template for log data"
}
}
```
{% include copy-curl.html %}

## Example response

```json
{
"acknowledged": true
}
```
44 changes: 37 additions & 7 deletions _api-reference/cluster-api/cluster-decommission.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,55 @@ redirect_from:
**Introduced 1.0**
{: .label .label-purple }

The cluster decommission operation adds support decommissioning based on awareness. It greatly benefits multi-zone deployments, where awareness attributes, such as `zones`, can aid in applying new upgrades to a cluster in a controlled fashion. This is especially useful during outages, in which case, you can decommission the unhealthy zone to prevent replication requests from stalling and prevent your request backlog from becoming too large.
The Cluster decommission API adds support decommissioning based on awareness. It greatly benefits multi-zone deployments, where awareness attributes, such as `zones`, can aid in applying new upgrades to a cluster in a controlled fashion. This is especially useful during outages, in which case, you can decommission the unhealthy zone to prevent replication requests from stalling and prevent your request backlog from becoming too large.

For more information about allocation awareness, see [Shard allocation awareness]({{site.url}}{{site.baseurl}}//opensearch/cluster/#shard-allocation-awareness).


<!-- spec_insert_start
api: cluster.get_decommission_awareness
component: endpoints
-->
## Endpoints
```json
GET /_cluster/decommission/awareness/{awareness_attribute_name}/_status
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.put_decommission_awareness
component: endpoints
omit_header: true
-->
```json
PUT /_cluster/decommission/awareness/{awareness_attribute_name}/{awareness_attribute_value}
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.delete_decommission_awareness
component: endpoints
omit_header: true
-->
```json
PUT /_cluster/decommission/awareness/{awareness_attribute_name}/{awareness_attribute_value}
GET /_cluster/decommission/awareness/{awareness_attribute_name}/_status
DELETE /_cluster/decommission/awareness
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.put_decommission_awareness
component: path_parameters
-->
## Path parameters

Parameter | Type | Description
:--- | :--- | :---
awareness_attribute_name | String | The name of awareness attribute, usually `zone`.
awareness_attribute_value | String | The value of the awareness attribute. For example, if you have shards allocated in two different zones, you can give each zone a value of `zone-a` or `zoneb`. The cluster decommission operation decommissions the zone listed in the method.
The following table lists the available path parameters.

| Parameter | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `awareness_attribute_name` | **Required** | String | The name of the awareness attribute. |
| `awareness_attribute_value` | **Required** | String | The value of the awareness attribute. |

<!-- spec_insert_end -->

## Example requests

Expand Down
61 changes: 39 additions & 22 deletions _api-reference/cluster-api/cluster-health.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,58 @@ The most basic cluster health request returns a simple status of the health of y

To get the status of a specific index, provide the index name.


<!-- spec_insert_start
api: cluster.health
component: endpoints
-->
## Endpoints

```json
GET _cluster/health
GET _cluster/health/<index>
GET /_cluster/health
GET /_cluster/health/{index}
```
<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.health
component: path_parameters
-->
## Path parameters

The following table lists the available path parameters. All path parameters are optional.

Parameter | Data type | Description
:--- | :--- | :---
&lt;index-name&gt; | String | Limits health reporting to a specific index. Can be a single index or a comma-separated list of index names.
| Parameter | Data type | Description |
| :--- | :--- | :--- |
| `index` | List or String | A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. |

<!-- spec_insert_end -->

<!-- spec_insert_start
api: cluster.health
columns: Parameter, Data type, Description, Default
component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.

Parameter | Type | Description
:--- | :--- | :---
expand_wildcards | Enum | Expands wildcard expressions to concrete indexes. 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`, `shards`, and `awareness_attributes`. Default is `cluster`.
awareness_attribute | String | The name of the awareness attribute, for which to return cluster health (for example, `zone`). Applicable only if `level` is set to `awareness_attributes`.
local | Boolean | Whether to return information from the local node only instead of from the cluster manager node. Default is `false`.
cluster_manager_timeout | Time | The amount of time to wait for a connection to the cluster manager 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.
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_nodes | String | Wait for N number of nodes. Use `12` for exact match, `>12` and `<12` for range.
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_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 health reaches the specified status or better. Supported values are `green`, `yellow`, and `red`.
weights | JSON object | Assigns weights to attributes within the request body of the PUT request. Weights can be set in any ration, for example, 2:3:5. In a 2:3:5 ratio with three zones, for every 100 requests sent to the cluster, each zone would receive either 20, 30, or 50 search requests in a random order. When assigned a weight of `0`, the zone does not receive any search traffic.
| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
| `awareness_attribute` | String | The name of the awareness attribute for which to return the cluster health status (for example, `zone`). Applicable only if `level` is set to `awareness_attributes`. | N/A |
| `cluster_manager_timeout` | String | A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |
| `expand_wildcards` | List or String | Specifies the type of index that wildcard expressions can match. Supports comma-separated values. <br> Valid values are: <br> - `all`: Match any index, including hidden ones. <br> - `closed`: Match closed, non-hidden indexes. <br> - `hidden`: Match hidden indexes. Must be combined with open, closed, or both. <br> - `none`: Wildcard expressions are not accepted. <br> - `open`: Match open, non-hidden indexes. | N/A |
| `level` | String | <br> Valid values are: `awareness_attributes`, `cluster`, `indices`, `shards` | `cluster` |
| `local` | Boolean | Whether to return information from the local node only instead of from the cluster manager node. | `false` |
| `timeout` | String | A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |
| `wait_for_active_shards` | Integer or String | Waits until the specified number of shards is active before returning a response. Use `all` for all shards. <br> Valid values are: `all`, `index-setting` | N/A |
| `wait_for_events` | String | Waits until all currently queued events with the given priority are processed. <br> Valid values are: `high`, `immediate`, `languid`, `low`, `normal`, `urgent` | N/A |
| `wait_for_no_initializing_shards` | Boolean | Whether to wait until there are no initializing shards in the cluster. | `false` |
| `wait_for_no_relocating_shards` | Boolean | Whether to wait until there are no relocating shards in the cluster. | N/A |
| `wait_for_nodes` | Float or String | Waits until the specified number of nodes (`N`) is available. Accepts `>=N`, `<=N`, `>N`, and `<N`. You can also use `ge(N)`, `le(N)`, `gt(N)`, and `lt(N)` notation. | N/A |
| `wait_for_status` | String | Waits until the cluster health reaches the specified status or better. <br> Valid values are: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED` | N/A |
| `master_timeout` <br> _DEPRECATED_ | String | _(Deprecated since 2.0: To promote inclusive language, use `cluster_manager_timeout` instead.)_ A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. | N/A |

<!-- spec_insert_end -->


## Example requests

Expand Down
Loading