diff --git a/CHANGELOG.md b/CHANGELOG.md index b63c1c14..76dbe778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added 404 responses to `/_alias/{name}` and `/{index}/_alias/{name}` ([#519](https://github.com/opensearch-project/opensearch-api-specification/pull/519)) - Added `asynchronous_search` ([#525](https://github.com/opensearch-project/opensearch-api-specification/pull/525)) - Added `DELETE /_plugins/_ml/tasks/{task_id}` ([#530](https://github.com/opensearch-project/opensearch-api-specification/pull/530)) +- Added `AwarenessAttributeStats` to `/_cluster/health` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534)) ### Changed diff --git a/spec/schemas/cluster.health.yaml b/spec/schemas/cluster.health.yaml index a479ca95..2daf6d10 100644 --- a/spec/schemas/cluster.health.yaml +++ b/spec/schemas/cluster.health.yaml @@ -17,11 +17,25 @@ components: type: number active_shards_percent_as_number: $ref: '_common.yaml#/components/schemas/Percentage' + awareness_attributes: + description: Cluster health information for each awareness attribute. + type: object + x-version-added: '2.5' + additionalProperties: + $ref: '#/components/schemas/AwarenessAttributeStats' cluster_name: $ref: '_common.yaml#/components/schemas/Name' delayed_unassigned_shards: description: The number of shards whose allocation has been delayed by the timeout settings. type: number + discovered_master: + description: True if the master node has been discovered. + type: boolean + x-version-deprecated: 2 + discovered_cluster_manager: + description: True if the cluster manager node has been discovered. + type: boolean + x-version-added: 2 indices: type: object additionalProperties: @@ -51,7 +65,7 @@ components: task_max_waiting_in_queue_millis: $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' timed_out: - description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default) + description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default). type: boolean unassigned_shards: description: The number of shards that are not allocated. @@ -111,6 +125,22 @@ components: - cluster - indices - shards + AwarenessAttributeStats: + type: object + x-version-added: '2.5' + properties: + active_shards: + type: number + initializing_shards: + type: number + relocating_shards: + type: number + unassigned_shards: + type: number + data_nodes: + type: number + weight: + type: number ShardHealthStats: type: object properties: diff --git a/tests/default/cluster/health.yaml b/tests/default/cluster/health.yaml new file mode 100644 index 00000000..3d00ab37 --- /dev/null +++ b/tests/default/cluster/health.yaml @@ -0,0 +1,28 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test cluster health. +chapters: + - synopsis: Returns a simple status of the health of the cluster. + path: /_cluster/health + method: GET + parameters: + expand_wildcards: all + level: cluster + local: false + timeout: 10s + wait_for_active_shards: 0 + wait_for_nodes: <2 + wait_for_events: normal + wait_for_no_relocating_shards: false + wait_for_no_initializing_shards: false + response: + status: 200 + - synopsis: Returns a status of the health of the cluster with awareness. + version: '>= 2.5' + path: /_cluster/health + method: GET + parameters: + level: awareness_attributes + awareness_attribute: zone + response: + status: 200 diff --git a/tests/default/cluster/health/index.yaml b/tests/default/cluster/health/index.yaml new file mode 100644 index 00000000..b9428ade --- /dev/null +++ b/tests/default/cluster/health/index.yaml @@ -0,0 +1,29 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test cluster health for an index. +prologues: + - path: /{index} + method: PUT + parameters: + index: books +epilogues: + - path: /books + method: DELETE + status: [200, 404] +chapters: + - synopsis: Returns a status of the health of the cluster for a given index. + path: /_cluster/health/{index} + method: GET + parameters: + index: books + expand_wildcards: all + level: cluster + local: false + timeout: 10s + wait_for_active_shards: 0 + wait_for_nodes: <2 + wait_for_events: normal + wait_for_no_relocating_shards: false + wait_for_no_initializing_shards: false + response: + status: 200