diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index b2b0e64de..442021c5b 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -842,6 +842,7 @@ paths: operationId: indices.get_upgrade.0 x-operation-group: indices.get_upgrade x-version-added: '1.0' + x-version-deprecated: '1.0' description: The `_upgrade` API is no longer useful and will be removed. externalDocs: url: https://opensearch.org/docs/latest @@ -856,6 +857,7 @@ paths: operationId: indices.upgrade.0 x-operation-group: indices.upgrade x-version-added: '1.0' + x-version-deprecated: '1.0' description: The `_upgrade` API is no longer useful and will be removed. externalDocs: url: https://opensearch.org/docs/latest @@ -865,6 +867,8 @@ paths: - $ref: '#/components/parameters/indices.upgrade::query.ignore_unavailable' - $ref: '#/components/parameters/indices.upgrade::query.only_ancient_segments' - $ref: '#/components/parameters/indices.upgrade::query.wait_for_completion' + requestBody: + $ref: '#/components/requestBodies/indices.upgrade' responses: '200': $ref: '#/components/responses/indices.upgrade@200' @@ -1825,6 +1829,7 @@ paths: operationId: indices.get_upgrade.1 x-operation-group: indices.get_upgrade x-version-added: '1.0' + x-version-deprecated: '1.0' description: The `_upgrade` API is no longer useful and will be removed. externalDocs: url: https://opensearch.org/docs/latest @@ -1840,6 +1845,7 @@ paths: operationId: indices.upgrade.1 x-operation-group: indices.upgrade x-version-added: '1.0' + x-version-deprecated: '1.0' description: The `_upgrade` API is no longer useful and will be removed. externalDocs: url: https://opensearch.org/docs/latest @@ -1850,6 +1856,8 @@ paths: - $ref: '#/components/parameters/indices.upgrade::query.ignore_unavailable' - $ref: '#/components/parameters/indices.upgrade::query.only_ancient_segments' - $ref: '#/components/parameters/indices.upgrade::query.wait_for_completion' + requestBody: + $ref: '#/components/requestBodies/indices.upgrade' responses: '200': $ref: '#/components/responses/indices.upgrade@200' @@ -2263,6 +2271,11 @@ components: $ref: '../schemas/indices.update_aliases.yaml#/components/schemas/Action' description: The definition of `actions` to perform required: true + indices.upgrade: + content: + application/json: + schema: + $ref: '../schemas/indices._common.yaml#/components/schemas/UpgradeRequest' indices.validate_query: content: application/json: @@ -2528,7 +2541,11 @@ components: type: object additionalProperties: $ref: '../schemas/indices._common.yaml#/components/schemas/TemplateMapping' - indices.get_upgrade@200: {} + indices.get_upgrade@200: + content: + application/json: + schema: + $ref: '../schemas/indices._common.yaml#/components/schemas/IndexGetUpgradeStatus' indices.open@200: content: application/json: @@ -2738,7 +2755,11 @@ components: application/json: schema: $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase' - indices.upgrade@200: {} + indices.upgrade@200: + content: + application/json: + schema: + $ref: '../schemas/indices._common.yaml#/components/schemas/IndexPostUpgradeStatus' indices.validate_query@200: content: application/json: diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index 2f08e5827..316cba4e3 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -1144,6 +1144,60 @@ components: - mappings - order - settings + IndexGetUpgradeStatus: + type: object + properties: + size_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + size_to_upgrade_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + size_to_upgrade_ancient_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + indices: + type: object + additionalProperties: + $ref: '#/components/schemas/UpgradeStatus' + UpgradeStatus: + type: object + properties: + size_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + size_to_upgrade_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + size_to_upgrade_ancient_in_bytes: + $ref: '_common.yaml#/components/schemas/ByteCount' + IndexPostUpgradeStatus: + type: object + properties: + _shards: + $ref: '_common.yaml#/components/schemas/ShardStatistics' + upgraded_indices: + type: object + additionalProperties: + $ref: '#/components/schemas/UpgradeVersionStatus' + UpgradeVersionStatus: + type: object + properties: + upgrade_version: + $ref: '_common.yaml#/components/schemas/VersionString' + oldest_lucene_segment_version: + $ref: '_common.yaml#/components/schemas/VersionString' + UpgradeRequest: + type: object + properties: + allow_no_indices: + type: boolean + expand_wildcards: + type: string + enum: + - all + - closed + - none + - open + ignore_unavailable: + type: boolean + wait_for_completion: + type: boolean IndexError: type: object properties: diff --git a/tests/default/indices/upgrade.yaml b/tests/default/indices/upgrade.yaml new file mode 100644 index 000000000..281f94029 --- /dev/null +++ b/tests/default/indices/upgrade.yaml @@ -0,0 +1,57 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test upgrading index using both GET and POST methods. +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: movies, _id: movie1}} + - {director: Bennett Miller, title: The Cruise, year: 1998} + - {create: {_index: movies, _id: movie2}} + - {director: Nicolas Winding Refn, title: Drive, year: 1960} +chapters: + - synopsis: Trigger index upgrade (POST). + path: /{index}/_upgrade + method: POST + parameters: + index: [movies] + request: + payload: + allow_no_indices: true + expand_wildcards: open + ignore_unavailable: true + response: + status: 200 + + - synopsis: Check index upgrade status (GET). + path: /{index}/_upgrade + method: GET + parameters: + index: [movies] + response: + status: 200 + + - synopsis: Trigger upgrade (POST). + path: /_upgrade + method: POST + request: + payload: + allow_no_indices: false + expand_wildcards: closed + ignore_unavailable: false + response: + status: 200 + + - synopsis: Check upgrade status (GET). + path: /_upgrade + method: GET + response: + status: 200 \ No newline at end of file