diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f693614..d54f2f88f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added response schema for `GET /_plugins/_knn/warmup/{index}` ([#717](https://github.com/opensearch-project/opensearch-api-specification/pull/717)) - Added support for multiple test verbs ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724)) - Added support for using a certificate and key in tests ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731)) +- Added `_type` to `termvector` and `mtermvector` ([#734](https://github.com/opensearch-project/opensearch-api-specification/pull/734)) +- Added missing `cancelled` and `resource_stats` to `/_reindex/{task_id}/_rethrottle` ([#740](https://github.com/opensearch-project/opensearch-api-specification/pull/740)) - Added `GET /_plugins/_ml/models/{model_id}`, `POST /_plugins/_ml/models/_search`, `PUT /_plugins/_ml/models/{model_id}`, `POST /_plugins/_ml/models/{model_id}/_unload`, `POST /_plugins/_ml/models/_unload`, `POST /_plugins/_ml/models/_undeploy`, `POST /_plugins/_ml/models/_upload`,`POST /_plugins/_ml/models/{model_id}/_load`, and `POST /_plugins/_ml/models/meta` ([#733](https://github.com/opensearch-project/opensearch-api-specification/pull/733)) ### Removed @@ -46,6 +48,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Removed unsupported `cause` and `create` from `/_index_template/_simulate_index/{name}` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691)) - Removed `mappings` from `required` in `indices.simulate_template#Template` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691)) - Removed `HealthStatusCapatilized` and merged it with `HealthStatus` ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725)) +- Removed `id` from `required` in `indices.termvectors@200` ([#734](https://github.com/opensearch-project/opensearch-api-specification/pull/734)) ### Fixed - Spec passes OpenAPI 3.1.0 validations ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646)) @@ -74,6 +77,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed request schema for `PATCH /_plugins/_security/api/nodesdn` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731)) - Fixed response schema for `GET /_plugins/_security/api/nodesdn/{cluster_name}` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731)) - 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)) ### 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)) diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index 229fc9e55..63a36d3d9 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -470,7 +470,7 @@ paths: operationId: reindex_rethrottle.0 x-operation-group: reindex_rethrottle x-version-added: '1.0' - description: Changes the number of requests per second for a particular Reindex operation. + description: Changes the number of requests per second for a particular reindex operation. externalDocs: url: https://opensearch.org/docs/latest parameters: @@ -3338,8 +3338,9 @@ components: format: int64 _version: $ref: '../schemas/_common.yaml#/components/schemas/VersionNumber' + _type: + $ref: '../schemas/_common.yaml#/components/schemas/Type' required: - - _id - _index - _version - found diff --git a/spec/schemas/_core.msearch_template.yaml b/spec/schemas/_core.msearch_template.yaml index f9e164e84..c87bbc3da 100644 --- a/spec/schemas/_core.msearch_template.yaml +++ b/spec/schemas/_core.msearch_template.yaml @@ -25,7 +25,9 @@ components: The value is the variable value. type: object additionalProperties: - type: object + oneOf: + - type: string + - type: object profile: description: When `true`, provides a profile for the query execution. type: boolean diff --git a/spec/schemas/_core.mtermvectors.yaml b/spec/schemas/_core.mtermvectors.yaml index deae8eda6..503dccafb 100644 --- a/spec/schemas/_core.mtermvectors.yaml +++ b/spec/schemas/_core.mtermvectors.yaml @@ -62,6 +62,8 @@ components: $ref: '_core.termvectors.yaml#/components/schemas/TermVector' error: $ref: '_common.yaml#/components/schemas/ErrorCause' + _type: + $ref: '_common.yaml#/components/schemas/Type' required: - _id - _index diff --git a/spec/schemas/_core.reindex_rethrottle.yaml b/spec/schemas/_core.reindex_rethrottle.yaml index 877dc024c..bc5ce3a8a 100644 --- a/spec/schemas/_core.reindex_rethrottle.yaml +++ b/spec/schemas/_core.reindex_rethrottle.yaml @@ -24,12 +24,16 @@ components: type: string cancellable: type: boolean + cancelled: + type: boolean description: type: string id: type: number node: $ref: '_common.yaml#/components/schemas/Name' + resource_stats: + $ref: '_common.yaml#/components/schemas/ResourceStats' running_time_in_nanos: $ref: '_common.yaml#/components/schemas/DurationValueUnitNanos' start_time_in_millis: diff --git a/tests/default/_core/msearch.yaml b/tests/default/_core/msearch/index.yaml similarity index 61% rename from tests/default/_core/msearch.yaml rename to tests/default/_core/msearch/index.yaml index 6cff72802..7cb893404 100644 --- a/tests/default/_core/msearch.yaml +++ b/tests/default/_core/msearch/index.yaml @@ -1,4 +1,4 @@ -$schema: ../../../json_schemas/test_story.schema.yaml +$schema: ../../../../json_schemas/test_story.schema.yaml description: Test document multi-search. epilogues: @@ -25,7 +25,9 @@ prologues: chapters: - synopsis: Run multiple search requests in single request (GET). path: /_msearch - method: GET + method: + - GET + - POST request: content_type: application/x-ndjson payload: @@ -52,34 +54,4 @@ chapters: - _index: movies _id: movie1 - _index: movies - _id: movie2 - - synopsis: Run multiple search requests in single request (POST). - path: /_msearch - method: POST - request: - content_type: application/x-ndjson - payload: - - {index: movies} - - {query: {match_all: {}}} - - {index: books} - - {query: {match_all: {}}} - response: - status: 200 - payload: - responses: - - hits: - total: - value: 2 - relation: eq - hits: - - _index: movies - _id: movie1 - - _index: movies - _id: movie2 - - hits: - total: - value: 1 - relation: eq - hits: - - _index: books - _id: book1 + _id: movie2 \ No newline at end of file diff --git a/tests/default/_core/msearch/template.yaml b/tests/default/_core/msearch/template.yaml new file mode 100644 index 000000000..f1246f644 --- /dev/null +++ b/tests/default/_core/msearch/template.yaml @@ -0,0 +1,35 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test _msearch/template APIs. +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book1}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 1960} + - {create: {_index: books, _id: book2}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991} + - {create: {_index: books, _id: book3}} + - {author: George Orwell, title: '1984', year: 1949} +epilogues: + - path: /books + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Perform a multi-search template query using a GET request. + path: /_msearch/template + method: + - GET + - POST + request: + content_type: application/x-ndjson + payload: + - {index: books} + - {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Mockingbird}} + - {index: books} + - {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Beast}} \ No newline at end of file diff --git a/tests/default/_core/mtermvectors.yaml b/tests/default/_core/mtermvectors.yaml new file mode 100644 index 000000000..497abd3ff --- /dev/null +++ b/tests/default/_core/mtermvectors.yaml @@ -0,0 +1,44 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test _mtermvectors APIs. +prologues: + - path: /books + method: PUT + request: + payload: + mappings: + properties: + author: + type: text + title: + term_vector: yes + type: text + year: + type: integer + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book1}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 1960} + - {create: {_index: books, _id: book2}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991} +epilogues: + - path: /books + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Retrieve term vectors for specific documents. + path: /_mtermvectors + method: + - GET + - POST + request: + payload: + docs: + - _id: book1 + _index: books \ No newline at end of file diff --git a/tests/default/_core/reindex/rethrottle.yaml b/tests/default/_core/reindex/rethrottle.yaml new file mode 100644 index 000000000..0f9ef01de --- /dev/null +++ b/tests/default/_core/reindex/rethrottle.yaml @@ -0,0 +1,44 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test changing the number of requests per second for a particular reindex operation. +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + - path: /videos + method: DELETE + status: [200, 404] +prologues: + - path: /{index}/_doc + method: POST + parameters: + index: movies + refresh: true + request: + payload: + title: Beauty and the Beast + year: 91 + status: [201] + - id: task + path: /_reindex + method: POST + parameters: + wait_for_completion: false + requests_per_second: 1 + request: + payload: + source: + index: movies + dest: + index: videos + output: + task_id: payload.task +chapters: + - synopsis: Change the value of `requests_per_second` on a running reindex. + path: /_reindex/{task_id}/_rethrottle + method: POST + parameters: + task_id: ${task.task_id} + requests_per_second: 2 + response: + status: 200 diff --git a/tests/default/_core/stats.yaml b/tests/default/_core/stats.yaml new file mode 100644 index 000000000..98d898ce7 --- /dev/null +++ b/tests/default/_core/stats.yaml @@ -0,0 +1,25 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test stats. +chapters: + - synopsis: Get global stats. + path: /_stats + method: GET + response: + status: 200 + - synopsis: Get global stats with human fields. + path: /_stats + method: GET + parameters: + human: true + response: + status: 200 + - synopsis: Get stats for a given metric. + path: /_stats/{metric} + method: GET + parameters: + metric: docs + expand_wildcards: all + forbid_closed_indices: false + groups: '*' + level: indices diff --git a/tests/default/indices/delete_by_query/rethrottle.yaml b/tests/default/indices/delete_by_query/rethrottle.yaml index 17507b0c3..3169ab20b 100644 --- a/tests/default/indices/delete_by_query/rethrottle.yaml +++ b/tests/default/indices/delete_by_query/rethrottle.yaml @@ -30,7 +30,7 @@ prologues: output: task_id: payload.task chapters: - - synopsis: Change the value of `requests_per_second``on a running delete by query. + - synopsis: Change the value of `requests_per_second` on a running delete by query. path: /_delete_by_query/{task_id}/_rethrottle method: POST parameters: diff --git a/tests/default/indices/msearch.yaml b/tests/default/indices/msearch/index.yaml similarity index 87% rename from tests/default/indices/msearch.yaml rename to tests/default/indices/msearch/index.yaml index ba5cd97eb..53fbb7122 100644 --- a/tests/default/indices/msearch.yaml +++ b/tests/default/indices/msearch/index.yaml @@ -1,4 +1,4 @@ -$schema: ../../../json_schemas/test_story.schema.yaml +$schema: ../../../../json_schemas/test_story.schema.yaml description: Test endpoints relevant to the lifecycle of an index, including multi-get and multi-search operations. prologues: @@ -22,7 +22,9 @@ epilogues: chapters: - synopsis: Perform a `_msearch` request to execute multiple search queries in a single call. path: /{index}/_msearch - method: POST + method: + - GET + - POST parameters: index: books request: @@ -31,6 +33,4 @@ chapters: - {index: books} - {query: {match: {title: To Kill a Mockingbird}}} - {index: books} - - {query: {match: {title: The Cruise}}} - response: - status: 200 \ No newline at end of file + - {query: {match: {title: The Cruise}}} \ No newline at end of file diff --git a/tests/default/indices/msearch/template.yaml b/tests/default/indices/msearch/template.yaml new file mode 100644 index 000000000..0586dc449 --- /dev/null +++ b/tests/default/indices/msearch/template.yaml @@ -0,0 +1,37 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test _msearch/template APIs. +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book1}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 1960} + - {create: {_index: books, _id: book2}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991} + - {create: {_index: books, _id: book3}} + - {author: George Orwell, title: '1984', year: 1949} +epilogues: + - path: /books + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Perform a multi-search template query using a GET request. + path: /{index}/_msearch/template + parameters: + index: books + method: + - GET + - POST + request: + content_type: application/x-ndjson + payload: + - {index: books} + - {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Mockingbird}} + - {index: books} + - {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Beast}} \ No newline at end of file diff --git a/tests/default/indices/mtermvectors.yaml b/tests/default/indices/mtermvectors.yaml new file mode 100644 index 000000000..e9a7978ed --- /dev/null +++ b/tests/default/indices/mtermvectors.yaml @@ -0,0 +1,45 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test _mtermvectors APIs. +prologues: + - path: /books + method: PUT + request: + payload: + mappings: + properties: + author: + type: text + title: + term_vector: yes + type: text + year: + type: integer + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book1}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 1960} + - {create: {_index: books, _id: book2}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991} +epilogues: + - path: /books + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Retrieve term vectors for specific documents in an index. + path: /{index}/_mtermvectors + parameters: + index: books + method: + - GET + - POST + request: + payload: + docs: + - _id: book1 \ No newline at end of file diff --git a/tests/default/indices/stats.yaml b/tests/default/indices/stats.yaml index 24caa7e2f..32e881b34 100644 --- a/tests/default/indices/stats.yaml +++ b/tests/default/indices/stats.yaml @@ -9,18 +9,6 @@ epilogues: method: DELETE status: [200, 404] chapters: - - synopsis: Get global stats. - path: /_stats - method: GET - response: - status: 200 - - synopsis: Get global stats with human fields. - path: /_stats - method: GET - parameters: - human: true - response: - status: 200 - synopsis: Get stats for an index. path: /{index}/_stats method: GET diff --git a/tests/default/indices/termvectors.yaml b/tests/default/indices/termvectors.yaml new file mode 100644 index 000000000..da53e1038 --- /dev/null +++ b/tests/default/indices/termvectors.yaml @@ -0,0 +1,53 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test _termvectors APIs. +prologues: + - path: /books + method: PUT + request: + payload: + mappings: + properties: + author: + type: text + title: + term_vector: yes + type: text + year: + type: integer + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: books, _id: book1}} + - {author: Harper Lee, title: To Kill a Mockingbird, year: 1960} + - {create: {_index: books, _id: book2}} + - {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991} +epilogues: + - path: /books + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Get term vectors for a specific index. + path: /{index}/_termvectors + parameters: + index: books + method: + - GET + - POST + request: + payload: + doc: + title: To kill + - synopsis: Get term vectors for a document by its ID. + path: /{index}/_termvectors/{id} + parameters: + index: books + id: book1 + method: + - GET + - POST \ No newline at end of file diff --git a/tests/plugins/security/_core/settings.yaml b/tests/plugins/security/_core/settings.yaml new file mode 100644 index 000000000..743bc4a49 --- /dev/null +++ b/tests/plugins/security/_core/settings.yaml @@ -0,0 +1,15 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test settings. +chapters: + - synopsis: Update cluster settings. + path: /_settings + method: PUT + request: + payload: + settings: + index: + number_of_replicas: 4 + - synopsis: Get settings. + path: /_settings + method: GET