diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 121632390..fce6a653c 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -44,10 +44,10 @@ jobs: tests: plugins/query_insights - version: 2.18.0 hub: opensearchstaging - ref: '@sha256:4445e195c53992038891519dc3be0d273cdaad1b047943d68921168ed243e7e9' + ref: '@sha256:9aee56bed4575bd0ebcc1537d01dbf9266e7946b77f5bd9015d51374d2c97dfb' - version: 3.0.0 hub: opensearchstaging - ref: '@sha256:727643acdfebed77bfdb26362dbcff536b7ea02a0cc4ae2da2521729171333de' + ref: '@sha256:01e1d8d0be4fb551fabd1e53ce2f3cab8757530664b7e698bc29f9b211d699da' name: test-opensearch-spec (version=${{ matrix.entry.version }}, hub=${{ matrix.entry.hub || 'opensearchproject' }}, tests=${{ matrix.entry.tests || 'default' }}) runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index f291cd4b9..d4cb0cb8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `config_id` and `config_id_list` to `/_plugins/_notifications/configs` query parameters ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594)) - Added a release workflow triggered on a tag ([#635](https://github.com/opensearch-project/opensearch-api-specification/pull/635)) - Added API spec for query insights plugin ([#625](https://github.com/opensearch-project/opensearch-api-specification/pull/625)) +- Added spec for _cluster/stats metric and index_metric filter paths([#639](https://github.com/opensearch-project/opensearch-api-specification/pull/639)) ### Changed diff --git a/spec/namespaces/cluster.yaml b/spec/namespaces/cluster.yaml index 8820d2eda..731f5da20 100644 --- a/spec/namespaces/cluster.yaml +++ b/spec/namespaces/cluster.yaml @@ -331,6 +331,39 @@ paths: responses: '200': $ref: '#/components/responses/cluster.stats@200' + /_cluster/stats/{metric}/nodes/{node_id}: + get: + operationId: cluster.stats.2 + x-operation-group: cluster.stats + x-version-added: '2.18' + description: Returns high-level overview of cluster statistics. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/ + parameters: + - $ref: '#/components/parameters/cluster.stats::path.metric' + - $ref: '#/components/parameters/cluster.stats::path.node_id' + - $ref: '#/components/parameters/cluster.stats::query.flat_settings' + - $ref: '#/components/parameters/cluster.stats::query.timeout' + responses: + '200': + $ref: '#/components/responses/cluster.stats@200' + /_cluster/stats/{metric}/{index_metric}/nodes/{node_id}: + get: + operationId: cluster.stats.3 + x-operation-group: cluster.stats + x-version-added: '2.18' + description: Returns high-level overview of cluster statistics. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/ + parameters: + - $ref: '#/components/parameters/cluster.stats::path.index_metric' + - $ref: '#/components/parameters/cluster.stats::path.metric' + - $ref: '#/components/parameters/cluster.stats::path.node_id' + - $ref: '#/components/parameters/cluster.stats::query.flat_settings' + - $ref: '#/components/parameters/cluster.stats::query.timeout' + responses: + '200': + $ref: '#/components/responses/cluster.stats@200' /_cluster/voting_config_exclusions: post: operationId: cluster.post_voting_config_exclusions.0 @@ -1380,6 +1413,27 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Duration' style: form + cluster.stats::path.index_metric: + in: path + name: index_metric + description: Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified. + required: true + schema: + type: array + items: + $ref: '../schemas/cluster.stats.yaml#/components/schemas/IndexMetric' + style: simple + cluster.stats::path.metric: + in: path + name: metric + description: Limit the information returned to the specified metrics + required: true + schema: + type: array + items: + $ref: '../schemas/cluster.stats.yaml#/components/schemas/Metric' + style: + simple cluster.stats::path.node_id: in: path name: node_id diff --git a/spec/schemas/cluster.stats.yaml b/spec/schemas/cluster.stats.yaml index 55a95cd61..c1c2e023c 100644 --- a/spec/schemas/cluster.stats.yaml +++ b/spec/schemas/cluster.stats.yaml @@ -689,3 +689,30 @@ components: - avg - max - min + Metric: + type: string + enum: + - _all + - discovery_type + - fs + - indices + - ingest + - jvm + - network_types + - os + - packaging_types + - plugins + - process + IndexMetric: + type: string + enum: + - _all + - analysis + - completion + - docs + - fielddata + - mappings + - query_cache + - segments + - shards + - store diff --git a/tests/default/cluster/stats/index_metric.yaml b/tests/default/cluster/stats/index_metric.yaml new file mode 100644 index 000000000..0c3674399 --- /dev/null +++ b/tests/default/cluster/stats/index_metric.yaml @@ -0,0 +1,17 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test cluster manager stats. +version: '>= 2.18' +chapters: + - synopsis: Get mapping and analysis indices stats. + path: /_cluster/stats/{metric}/{index_metric}/nodes/{node_id} + method: GET + parameters: + node_id: _all + metric: + - indices + index_metric: + - analysis + - mappings + response: + status: 200 diff --git a/tests/default/cluster/stats/metric.yaml b/tests/default/cluster/stats/metric.yaml new file mode 100644 index 000000000..bd7d7ac39 --- /dev/null +++ b/tests/default/cluster/stats/metric.yaml @@ -0,0 +1,15 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test cluster manager stats. +version: '>= 2.18' +chapters: + - synopsis: Get nodes fs and jvm stats. + path: /_cluster/stats/{metric}/nodes/{node_id} + method: GET + parameters: + node_id: _all + metric: + - fs + - jvm + response: + status: 200