Skip to content

Commit 3ceb510

Browse files
author
Swetha Guptha
committed
Add spec for cluster stats metric and index_metric filter path.
Signed-off-by: Swetha Guptha <gupthasg@amazon.com>
1 parent fce5721 commit 3ceb510

File tree

5 files changed

+117
-25
lines changed

5 files changed

+117
-25
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
129129
- Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641))
130130
- Added a spec style checker [#620](https://github.com/opensearch-project/opensearch-api-specification/pull/620).
131131
- Added `remote_store` to node `Stats` ([#643](https://github.com/opensearch-project/opensearch-api-specification/pull/643))
132+
- Added `/_cluster/stats/{metric}/nodes/{node_id}` and `/_cluster/stats/{metric}/{index_metric}/nodes/{node_id}` ([#639](https://github.com/opensearch-project/opensearch-api-specification/pull/639))
132133

133134
### Changed
134135

spec/namespaces/cluster.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,39 @@ paths:
331331
responses:
332332
'200':
333333
$ref: '#/components/responses/cluster.stats@200'
334+
/_cluster/stats/{metric}/nodes/{node_id}:
335+
get:
336+
operationId: cluster.stats.2
337+
x-operation-group: cluster.stats
338+
x-version-added: '2.18'
339+
description: Returns high-level overview of cluster statistics.
340+
externalDocs:
341+
url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/
342+
parameters:
343+
- $ref: '#/components/parameters/cluster.stats::path.metric'
344+
- $ref: '#/components/parameters/cluster.stats::path.node_id'
345+
- $ref: '#/components/parameters/cluster.stats::query.flat_settings'
346+
- $ref: '#/components/parameters/cluster.stats::query.timeout'
347+
responses:
348+
'200':
349+
$ref: '#/components/responses/cluster.stats@200'
350+
/_cluster/stats/{metric}/{index_metric}/nodes/{node_id}:
351+
get:
352+
operationId: cluster.stats.3
353+
x-operation-group: cluster.stats
354+
x-version-added: '2.18'
355+
description: Returns high-level overview of cluster statistics.
356+
externalDocs:
357+
url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/
358+
parameters:
359+
- $ref: '#/components/parameters/cluster.stats::path.index_metric'
360+
- $ref: '#/components/parameters/cluster.stats::path.metric'
361+
- $ref: '#/components/parameters/cluster.stats::path.node_id'
362+
- $ref: '#/components/parameters/cluster.stats::query.flat_settings'
363+
- $ref: '#/components/parameters/cluster.stats::query.timeout'
364+
responses:
365+
'200':
366+
$ref: '#/components/responses/cluster.stats@200'
334367
/_cluster/voting_config_exclusions:
335368
post:
336369
operationId: cluster.post_voting_config_exclusions.0
@@ -1380,6 +1413,27 @@ components:
13801413
schema:
13811414
$ref: '../schemas/_common.yaml#/components/schemas/Duration'
13821415
style: form
1416+
cluster.stats::path.index_metric:
1417+
in: path
1418+
name: index_metric
1419+
description: Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric is specified.
1420+
required: true
1421+
schema:
1422+
type: array
1423+
items:
1424+
$ref: '../schemas/cluster.stats.yaml#/components/schemas/IndexMetric'
1425+
style: simple
1426+
cluster.stats::path.metric:
1427+
in: path
1428+
name: metric
1429+
description: Limit the information returned to the specified metrics
1430+
required: true
1431+
schema:
1432+
type: array
1433+
items:
1434+
$ref: '../schemas/cluster.stats.yaml#/components/schemas/Metric'
1435+
style:
1436+
simple
13831437
cluster.stats::path.node_id:
13841438
in: path
13851439
name: node_id

spec/schemas/cluster.stats.yaml

+27-25
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ components:
2727
required:
2828
- cluster_name
2929
- cluster_uuid
30-
- indices
31-
- nodes
3230
- status
3331
- timestamp
3432
ClusterIndices:
@@ -60,17 +58,6 @@ components:
6058
type: array
6159
items:
6260
$ref: '#/components/schemas/IndicesVersions'
63-
required:
64-
- analysis
65-
- completion
66-
- count
67-
- docs
68-
- fielddata
69-
- mappings
70-
- query_cache
71-
- segments
72-
- shards
73-
- store
7461
CharFilterTypes:
7562
type: object
7663
properties:
@@ -271,18 +258,6 @@ components:
271258
type: array
272259
items:
273260
$ref: '_common.yaml#/components/schemas/VersionString'
274-
required:
275-
- count
276-
- discovery_types
277-
- fs
278-
- ingest
279-
- jvm
280-
- network_types
281-
- os
282-
- packaging_types
283-
- plugins
284-
- process
285-
- versions
286261
ClusterNodeCount:
287262
type: object
288263
properties:
@@ -689,3 +664,30 @@ components:
689664
- avg
690665
- max
691666
- min
667+
Metric:
668+
type: string
669+
enum:
670+
- _all
671+
- discovery_type
672+
- fs
673+
- indices
674+
- ingest
675+
- jvm
676+
- network_types
677+
- os
678+
- packaging_types
679+
- plugins
680+
- process
681+
IndexMetric:
682+
type: string
683+
enum:
684+
- _all
685+
- analysis
686+
- completion
687+
- docs
688+
- fielddata
689+
- mappings
690+
- query_cache
691+
- segments
692+
- shards
693+
- store
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$schema: ../../../../json_schemas/test_story.schema.yaml
2+
3+
description: Test cluster manager stats.
4+
# TODO: Re-enable in 3.0, see https://github.com/opensearch-project/opensearch-api-specification/pull/613
5+
version: '>= 2.18 < 3'
6+
chapters:
7+
- synopsis: Get mapping and analysis indices stats.
8+
path: /_cluster/stats/{metric}/{index_metric}/nodes/{node_id}
9+
method: GET
10+
parameters:
11+
node_id: _all
12+
metric:
13+
- indices
14+
index_metric:
15+
- analysis
16+
- mappings
17+
response:
18+
status: 200
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$schema: ../../../../json_schemas/test_story.schema.yaml
2+
3+
description: Test cluster manager stats.
4+
# TODO: Re-enable in 3.0, see https://github.com/opensearch-project/opensearch-api-specification/pull/613
5+
version: '>= 2.18 < 3'
6+
chapters:
7+
- synopsis: Get nodes fs and jvm stats.
8+
path: /_cluster/stats/{metric}/nodes/{node_id}
9+
method: GET
10+
parameters:
11+
node_id: _all
12+
metric:
13+
- fs
14+
- jvm
15+
response:
16+
status: 200
17+

0 commit comments

Comments
 (0)