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

[Proposal] Update API template #7709

Merged
merged 11 commits into from
Jul 24, 2024
4 changes: 2 additions & 2 deletions API_STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Include a table with these columns:
Field | Data type | Description
:--- | :--- | :---

#### Example request
## Example request

Provide a sentence that describes what is shown in the example, followed by a cut-and-paste-ready API request in JSON format. Make sure that you test the request yourself in the Dashboards Dev Tools console to make sure it works. See the following examples.

Expand All @@ -139,7 +139,7 @@ POST _reindex
}
```

#### Example response
## Example response

Include a JSON example response to show what the API returns. See the following examples.

Expand Down
2 changes: 1 addition & 1 deletion _api-reference/analyze-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Field | Data type | Description
:--- | :--- | :---
text | String or Array of Strings | Text to analyze. If you provide an array of strings, the text is analyzed as a multi-value field.

#### Example requests
## Example requests

[Analyze array of text strings](#analyze-array-of-text-strings)

Expand Down
43 changes: 22 additions & 21 deletions _api-reference/cat/cat-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,6 @@ has_children: false

The CAT aliases operation lists the mapping of aliases to indexes, plus routing and filtering information.

## Example

```json
GET _cat/aliases?v
```
{% include copy-curl.html %}

To limit the information to a specific alias, add the alias name after your query:

```json
GET _cat/aliases/<alias>?v
```
{% include copy-curl.html %}

If you want to get information for more than one alias, separate the alias names with commas:

```json
GET _cat/aliases/alias1,alias2,alias3
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -55,7 +35,28 @@ Parameter | Type | Description
local | Boolean | Whether to return information from the local node only instead of from the cluster manager node. Default is `false`.
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`.

## Response
## Example requests

```json
GET _cat/aliases?v
```
{% include copy-curl.html %}

To limit the information to a specific alias, add the alias name after your query:

```json
GET _cat/aliases/<alias>?v
```
{% include copy-curl.html %}

If you want to get information for more than one alias, separate the alias names with commas:

```json
GET _cat/aliases/alias1,alias2,alias3
```
{% include copy-curl.html %}

## Example response

The following response shows that `alias1` refers to a `movies` index and has a configured filter:

Expand Down
43 changes: 22 additions & 21 deletions _api-reference/cat/cat-allocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ has_children: false

The CAT allocation operation lists the allocation of disk space for indexes and the number of shards on each node.

## Example

```json
GET _cat/allocation?v
```
{% include copy-curl.html %}

To limit the information to a specific node, add the node name after your query:

```json
GET _cat/allocation/<node_name>
```
{% include copy-curl.html %}

If you want to get information for more than one node, separate the node names with commas:

```json
GET _cat/allocation/node_name_1,node_name_2,node_name_3
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -54,7 +34,28 @@ bytes | Byte size | Specify the units for byte size. For example, `7kb` or `6gb`
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.

## Response
## Example requests

```json
GET _cat/allocation?v
```
{% include copy-curl.html %}

To limit the information to a specific node, add the node name after your query:

```json
GET _cat/allocation/<node_name>
```
{% include copy-curl.html %}

If you want to get information for more than one node, separate the node names with commas:

```json
GET _cat/allocation/node_name_1,node_name_2,node_name_3
```
{% include copy-curl.html %}

## Example response

The following response shows that eight shards are allocated to each of the two nodes available:

Expand Down
15 changes: 8 additions & 7 deletions _api-reference/cat/cat-cluster_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ has_children: false

The CAT cluster manager operation lists information that helps identify the elected cluster manager node.

## Example

```
GET _cat/cluster_manager?v
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -37,7 +31,14 @@ Parameter | Type | Description
:--- | :--- | :---
cluster_manager_timeout | Time | The amount of time to wait for a connection to the cluster manager node. Default is 30 seconds.

## Response
## Example requests

```
GET _cat/cluster_manager?v
```
{% include copy-curl.html %}

## Example response

```json
id | host | ip | node
Expand Down
28 changes: 14 additions & 14 deletions _api-reference/cat/cat-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@

The CAT count operation lists the number of documents in your cluster.

## Example

## Path and HTTP methods

```
GET _cat/count?v
GET _cat/count/<index>?v
```

## URL parameters

All CAT count URL parameters are optional. You can specify any of the [common URL parameters]({{site.url}}{{site.baseurl}}/api-reference/cat/index).

Check failure on line 28 in _api-reference/cat/cat-count.md

View workflow job for this annotation

GitHub Actions / vale

[vale] _api-reference/cat/cat-count.md#L28

[OpenSearch.LinksEndSlash] Add a trailing slash to the link '({{site.url}}{{site.baseurl}}/api-reference/cat/index)'.
Raw output
{"message": "[OpenSearch.LinksEndSlash] Add a trailing slash to the link '({{site.url}}{{site.baseurl}}/api-reference/cat/index)'.", "location": {"path": "_api-reference/cat/cat-count.md", "range": {"start": {"line": 28, "column": 94}}}, "severity": "ERROR"}

## Example requests

```json
GET _cat/count?v
Expand All @@ -36,19 +48,7 @@
```
{% include copy-curl.html %}

## Path and HTTP methods

```
GET _cat/count?v
GET _cat/count/<index>?v
```

## URL parameters

All CAT count URL parameters are optional. You can specify any of the [common URL parameters]({{site.url}}{{site.baseurl}}/api-reference/cat/index).


## Response
## Example response

The following response shows the overall document count as 1625:

Expand Down
43 changes: 22 additions & 21 deletions _api-reference/cat/cat-field-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@
- /opensearch/rest-api/cat/cat-field-data/
---

# CAT fielddata
# CAT Field Data

Check failure on line 11 in _api-reference/cat/cat-field-data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] _api-reference/cat/cat-field-data.md#L11

[OpenSearch.HeadingCapitalization] 'CAT Field Data' is a heading and should be in sentence case.
Raw output
{"message": "[OpenSearch.HeadingCapitalization] 'CAT Field Data' is a heading and should be in sentence case.", "location": {"path": "_api-reference/cat/cat-field-data.md", "range": {"start": {"line": 11, "column": 3}}}, "severity": "ERROR"}
**Introduced 1.0**
{: .label .label-purple }

The CAT fielddata operation lists the memory size used by each field per node.
The CAT Field Data operation lists the memory size used by each field per node.

## Example

## Path and HTTP methods

```
GET _cat/fielddata?v
GET _cat/fielddata/<field_name>?v
```

## URL parameters

All CAT fielddata URL parameters are optional.

In addition to the [common URL parameters]({{site.url}}{{site.baseurl}}/api-reference/cat/index), you can specify the following parameter:

Check failure on line 29 in _api-reference/cat/cat-field-data.md

View workflow job for this annotation

GitHub Actions / vale

[vale] _api-reference/cat/cat-field-data.md#L29

[OpenSearch.LinksEndSlash] Add a trailing slash to the link '({{site.url}}{{site.baseurl}}/api-reference/cat/index)'.
Raw output
{"message": "[OpenSearch.LinksEndSlash] Add a trailing slash to the link '({{site.url}}{{site.baseurl}}/api-reference/cat/index)'.", "location": {"path": "_api-reference/cat/cat-field-data.md", "range": {"start": {"line": 29, "column": 43}}}, "severity": "ERROR"}

Parameter | Type | Description
:--- | :--- | :---
bytes | Byte size | Specify the units for byte size. For example, `7kb` or `6gb`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/opensearch/units/).

## Example requests

```json
GET _cat/fielddata?v
Expand All @@ -35,24 +53,7 @@
```
{% include copy-curl.html %}

## Path and HTTP methods

```
GET _cat/fielddata?v
GET _cat/fielddata/<field_name>?v
```

## URL parameters

All CAT fielddata URL parameters are optional.

In addition to the [common URL parameters]({{site.url}}{{site.baseurl}}/api-reference/cat/index), you can specify the following parameter:

Parameter | Type | Description
:--- | :--- | :---
bytes | Byte size | Specify the units for byte size. For example, `7kb` or `6gb`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/opensearch/units/).

## Response
## Example response

The following response shows the memory size for all fields as 284 bytes:

Expand Down
16 changes: 9 additions & 7 deletions _api-reference/cat/cat-health.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ redirect_from:

The CAT health operation lists the status of the cluster, how long the cluster has been up, the number of nodes, and other useful information that helps you analyze the health of your cluster.

## Example

```json
GET _cat/health?v
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -38,7 +32,15 @@ Parameter | Type | Description
time | Time | Specify the units for time. For example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/opensearch/units/).
ts | Boolean | If true, returns HH:MM:SS and Unix epoch timestamps. Default is `true`.

## Response
## Example request

The following example request give cluster health information for the past 5 days:

```json
GET _cat/health?v&time=5d
```

## Example response

```json
GET _cat/health?v&time=5d
Expand Down
43 changes: 22 additions & 21 deletions _api-reference/cat/cat-indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ redirect_from:

The CAT indices operation lists information related to indexes, that is, how much disk space they are using, how many shards they have, their health status, and so on.

## Example

```
GET _cat/indices?v
```
{% include copy-curl.html %}

To limit the information to a specific index, add the index name after your query.

```
GET _cat/indices/<index>?v
```
{% include copy-curl.html %}

If you want to get information for more than one index, separate the indexes with commas:

```json
GET _cat/indices/index1,index2,index3
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -58,8 +38,29 @@ pri | Boolean | Whether to return information only from the primary shards. Defa
time | Time | Specify the units for time. For example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/opensearch/units/).
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`.

## Example requests

```
GET _cat/indices?v
```
{% include copy-curl.html %}

To limit the information to a specific index, add the index name after your query.

```
GET _cat/indices/<index>?v
```
{% include copy-curl.html %}

If you want to get information for more than one index, separate the indexes with commas:

```json
GET _cat/indices/index1,index2,index3
```
{% include copy-curl.html %}


## Response
## Example response

```json
health | status | index | uuid | pri | rep | docs.count | docs.deleted | store.size | pri.store.size
Expand Down
17 changes: 10 additions & 7 deletions _api-reference/cat/cat-nodeattrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ redirect_from:

The CAT nodeattrs operation lists the attributes of custom nodes.

## Example

```
GET _cat/nodeattrs?v
```
{% include copy-curl.html %}

## Path and HTTP methods

Expand All @@ -38,8 +32,17 @@ Parameter | Type | Description
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.

## Example request

The following example request returns attributes about custom nodes:

```
GET _cat/nodeattrs?v
```
{% include copy-curl.html %}


## Response
## Example response

```json
node | host | ip | attr | value
Expand Down
Loading
Loading