Skip to content

Commit

Permalink
Fix cluster schemas (#754)
Browse files Browse the repository at this point in the history
* Fix cluster schemas

Signed-off-by: Thomas Farr <[email protected]>

* changelog

Signed-off-by: Thomas Farr <[email protected]>

* Fix vale

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Dec 27, 2024
1 parent edf9d6f commit 1dac3c9
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 150 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed request body for `/_search/scroll/{scroll_id}` ([#732](https://github.com/opensearch-project/opensearch-api-specification/pull/732))
- Fixed type in `_msearch/template` ([#735](https://github.com/opensearch-project/opensearch-api-specification/pull/735))
- Fixed indices API schemas ([#750](https://github.com/opensearch-project/opensearch-api-specification/pull/750))
- Fixed cluster API schemas ([#754](https://github.com/opensearch-project/opensearch-api-specification/pull/754))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
76 changes: 55 additions & 21 deletions spec/namespaces/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ paths:
url: https://opensearch.org/docs/latest
parameters:
- $ref: '#/components/parameters/cluster.get_component_template::query.cluster_manager_timeout'
- $ref: '#/components/parameters/cluster.get_component_template::query.flat_settings'
- $ref: '#/components/parameters/cluster.get_component_template::query.local'
- $ref: '#/components/parameters/cluster.get_component_template::query.master_timeout'
responses:
Expand All @@ -417,6 +418,7 @@ paths:
parameters:
- $ref: '#/components/parameters/cluster.get_component_template::path.name'
- $ref: '#/components/parameters/cluster.get_component_template::query.cluster_manager_timeout'
- $ref: '#/components/parameters/cluster.get_component_template::query.flat_settings'
- $ref: '#/components/parameters/cluster.get_component_template::query.local'
- $ref: '#/components/parameters/cluster.get_component_template::query.master_timeout'
responses:
Expand Down Expand Up @@ -528,7 +530,8 @@ components:
type: boolean
shard:
description: Specifies the ID of the shard that you would like an explanation for.
type: number
type: integer
format: int32
description: The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'
cluster.put_component_template:
content:
Expand Down Expand Up @@ -637,7 +640,8 @@ components:
remaining_delay_in_millis:
$ref: '../schemas/_common.yaml#/components/schemas/DurationValueUnitMillis'
shard:
type: number
type: integer
format: int32
unassigned_info:
$ref: '../schemas/cluster.allocation_explain.yaml#/components/schemas/UnassignedInformation'
note:
Expand Down Expand Up @@ -772,32 +776,54 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
explanations:
type: array
items:
$ref: '../schemas/cluster.reroute.yaml#/components/schemas/RerouteExplanation'
state:
description: |-
There aren't any guarantees on the output/structure of the raw cluster state.
Here you will find the internal representation of the cluster, which can
differ from the external representation.
type: object
required:
- acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
explanations:
type: array
items:
$ref: '../schemas/cluster.reroute.yaml#/components/schemas/RerouteExplanation'
state:
description: |-
There aren't any guarantees on the output/structure of the raw cluster state.
Here you will find the internal representation of the cluster, which can
differ from the external representation.
cluster.state@200:
content:
application/json:
schema:
type: object
schema: {}
cluster.stats@200:
content:
application/json:
schema:
$ref: '../schemas/cluster.stats.yaml#/components/schemas/StatsResponseBase'
allOf:
- $ref: '../schemas/nodes._common.yaml#/components/schemas/NodesResponseBase'
- type: object
properties:
cluster_name:
description: Name of the cluster, based on the Cluster name setting setting.
$ref: '../schemas/_common.yaml#/components/schemas/Name'
cluster_uuid:
description: Unique identifier for the cluster.
$ref: '../schemas/_common.yaml#/components/schemas/Uuid'
indices:
description: Contains statistics about indexes with shards assigned to selected nodes.
$ref: '../schemas/cluster.stats.yaml#/components/schemas/ClusterIndices'
nodes:
description: Contains statistics about nodes selected by the request's node filters.
$ref: '../schemas/cluster.stats.yaml#/components/schemas/ClusterNodes'
status:
description: Health status of the cluster, based on the state of its primary and replica shards.
$ref: '../schemas/_common.yaml#/components/schemas/HealthStatus'
timestamp:
description: Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed.
$ref: '../schemas/_common.yaml#/components/schemas/EpochTimeUnitMillis'
required:
- cluster_name
- cluster_uuid
- status
- timestamp
parameters:
cluster.allocation_explain::query.include_disk_info:
in: query
Expand Down Expand Up @@ -924,6 +950,14 @@ components:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/Duration'
x-version-added: '2.0'
cluster.get_component_template::query.flat_settings:
in: query
name: flat_settings
description: If `true`, returns settings in flat format.
schema:
type: boolean
default: false
style: form
cluster.get_component_template::query.local:
in: query
name: local
Expand Down
12 changes: 8 additions & 4 deletions spec/schemas/cluster.allocation_explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ components:
path:
type: string
total:
type: number
type: integer
format: int64
shards:
type: array
items:
Expand All @@ -140,7 +141,8 @@ components:
transport_address:
$ref: '_common.yaml#/components/schemas/TransportAddress'
weight_ranking:
type: number
type: integer
format: int32
required:
- attributes
- id
Expand Down Expand Up @@ -169,7 +171,8 @@ components:
transport_address:
$ref: '_common.yaml#/components/schemas/TransportAddress'
weight_ranking:
type: number
type: integer
format: int32
required:
- deciders
- node_attributes
Expand Down Expand Up @@ -211,7 +214,8 @@ components:
details:
type: string
failed_allocation_attempts:
type: number
type: integer
format: int32
delayed:
type: boolean
allocation_status:
Expand Down
81 changes: 54 additions & 27 deletions spec/schemas/cluster.health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ components:
properties:
active_primary_shards:
description: The number of active primary shards.
type: number
type: integer
format: int32
active_shards:
description: The total number of active primary and replica shards.
type: number
type: integer
format: int32
active_shards_percent:
$ref: '_common.yaml#/components/schemas/PercentageString'
active_shards_percent_as_number:
Expand All @@ -29,7 +31,8 @@ components:
$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
type: integer
format: int32
discovered_master:
description: True if the cluster-manager node has been discovered.
type: boolean
Expand All @@ -44,22 +47,28 @@ components:
$ref: '#/components/schemas/IndexHealthStats'
initializing_shards:
description: The number of shards that are under initialization.
type: number
type: integer
format: int32
number_of_data_nodes:
description: The number of nodes that are dedicated data nodes.
type: number
type: integer
format: int32
number_of_in_flight_fetch:
description: The number of unfinished fetches.
type: number
type: integer
format: int32
number_of_nodes:
description: The number of nodes within the cluster.
type: number
type: integer
format: int32
number_of_pending_tasks:
description: The number of cluster-level changes that have not yet been executed.
type: number
type: integer
format: int32
relocating_shards:
description: The number of shards that are under relocation.
type: number
type: integer
format: int32
status:
$ref: '_common.yaml#/components/schemas/HealthStatus'
task_max_waiting_in_queue:
Expand All @@ -71,7 +80,8 @@ components:
type: boolean
unassigned_shards:
description: The number of shards that are not allocated.
type: number
type: integer
format: int32
required:
- active_primary_shards
- active_shards
Expand All @@ -92,25 +102,32 @@ components:
type: object
properties:
active_primary_shards:
type: number
type: integer
format: int32
active_shards:
type: number
type: integer
format: int32
initializing_shards:
type: number
type: integer
format: int32
number_of_replicas:
type: number
type: integer
format: int32
number_of_shards:
type: number
type: integer
format: int32
relocating_shards:
type: number
type: integer
format: int32
shards:
type: object
additionalProperties:
$ref: '#/components/schemas/ShardHealthStats'
status:
$ref: '_common.yaml#/components/schemas/HealthStatus'
unassigned_shards:
type: number
type: integer
format: int32
required:
- active_primary_shards
- active_shards
Expand All @@ -132,32 +149,42 @@ components:
x-version-added: '2.5'
properties:
active_shards:
type: number
type: integer
format: int32
initializing_shards:
type: number
type: integer
format: int32
relocating_shards:
type: number
type: integer
format: int32
unassigned_shards:
type: number
type: integer
format: int32
data_nodes:
type: number
type: integer
format: int32
weight:
type: number
type: integer
format: int32
ShardHealthStats:
type: object
properties:
active_shards:
type: number
type: integer
format: int32
initializing_shards:
type: number
type: integer
format: int32
primary_active:
type: boolean
relocating_shards:
type: number
type: integer
format: int32
status:
$ref: '_common.yaml#/components/schemas/HealthStatus'
unassigned_shards:
type: number
type: integer
format: int32
required:
- active_shards
- initializing_shards
Expand Down
3 changes: 2 additions & 1 deletion spec/schemas/cluster.pending_tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ components:
type: boolean
insert_order:
description: The number that represents when the task has been inserted into the task queue.
type: number
type: integer
format: int32
priority:
description: |-
The priority of the pending task.
Expand Down
12 changes: 8 additions & 4 deletions spec/schemas/cluster.remote_info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ components:
connected:
type: boolean
max_connections_per_cluster:
type: number
type: integer
format: int32
num_nodes_connected:
type: number
type: integer
format: int64
initial_connect_timeout:
$ref: '_common.yaml#/components/schemas/Duration'
skip_unavailable:
Expand Down Expand Up @@ -60,9 +62,11 @@ components:
server_name:
type: string
num_proxy_sockets_connected:
type: number
type: integer
format: int32
max_proxy_socket_connections:
type: number
type: integer
format: int32
required:
- connected
- initial_connect_timeout
Expand Down
Loading

0 comments on commit 1dac3c9

Please sign in to comment.