diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b9cb13ee..e2834f9df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615)) - Added missing `status` to `/_search/template` response ([#702](https://github.com/opensearch-project/opensearch-api-specification/pull/702)) - Added `_type` to `rank_eval` API specs ([#704](https://github.com/opensearch-project/opensearch-api-specification/pull/704)) -- Added request body to `_search_shards` API specs ([#709](https://github.com/opensearch-project/opensearch-api-specification/pull/709)) - Added NodeAttributes as additional property in `shard_stores` API specs ([#715](https://github.com/opensearch-project/opensearch-api-specification/pull/715)) - Added missing `repository` query parameter to `/_cat/snapshots` ([#700](https://github.com/opensearch-project/opensearch-api-specification/pull/700)) - Added `sm` namespace API specifications ([#701](https://github.com/opensearch-project/opensearch-api-specification/pull/701)) @@ -96,6 +95,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed nodes API schemas ([#761](https://github.com/opensearch-project/opensearch-api-specification/pull/761)) - Fixed ingest API schemas ([#766](https://github.com/opensearch-project/opensearch-api-specification/pull/766)) - Fixed CAT API schemas ([#769](https://github.com/opensearch-project/opensearch-api-specification/pull/769)) +- Fixed core API schemas ([#777](https://github.com/opensearch-project/opensearch-api-specification/pull/777)) ### 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 ee5ca443e..3d24fb9b2 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -455,6 +455,7 @@ paths: - $ref: '#/components/parameters/reindex::query.max_docs' - $ref: '#/components/parameters/reindex::query.refresh' - $ref: '#/components/parameters/reindex::query.requests_per_second' + - $ref: '#/components/parameters/reindex::query.require_alias' - $ref: '#/components/parameters/reindex::query.scroll' - $ref: '#/components/parameters/reindex::query.slices' - $ref: '#/components/parameters/reindex::query.timeout' @@ -1028,8 +1029,6 @@ paths: - $ref: '#/components/parameters/search_shards::query.local' - $ref: '#/components/parameters/search_shards::query.preference' - $ref: '#/components/parameters/search_shards::query.routing' - requestBody: - $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards@200' @@ -1047,8 +1046,6 @@ paths: - $ref: '#/components/parameters/search_shards::query.local' - $ref: '#/components/parameters/search_shards::query.preference' - $ref: '#/components/parameters/search_shards::query.routing' - requestBody: - $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards@200' @@ -2011,8 +2008,6 @@ paths: - $ref: '#/components/parameters/search_shards::query.local' - $ref: '#/components/parameters/search_shards::query.preference' - $ref: '#/components/parameters/search_shards::query.routing' - requestBody: - $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards@200' @@ -2031,8 +2026,6 @@ paths: - $ref: '#/components/parameters/search_shards::query.local' - $ref: '#/components/parameters/search_shards::query.preference' - $ref: '#/components/parameters/search_shards::query.routing' - requestBody: - $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards@200' @@ -2703,46 +2696,6 @@ components: type: string description: The search definition template and its parameters. required: true - search_shards: - content: - application/json: - schema: - type: object - properties: - query: - description: Defines the search query to filter shards. Supports any query that is valid for the `_search` endpoint. - type: object - additionalProperties: - type: object - indices_boost: - description: Allows increasing the relevance of specific indexes in the search. - type: object - additionalProperties: - type: number - allow_partial_search_results: - description: Indicates whether partial search results are allowed if some shards are unavailable. - type: boolean - _source: - description: Specifies which fields to include in the `_source` response or excludes specific fields. - oneOf: - - type: boolean - - type: array - items: - type: string - from: - description: The starting offset (default 0) for paginated results. - type: integer - size: - description: The maximum number of results to return (default 10). - type: integer - sort: - description: A list of fields and directions for sorting the results. - type: array - items: - type: object - additionalProperties: - type: string - description: Defines the parameters that can be used in the `search_shards` endpoint request. See documentation for supported query syntax. termvectors: content: application/json: @@ -2921,7 +2874,7 @@ components: pit_id: type: string _shards: - $ref: '../schemas/_core._common.yaml#/components/schemas/ShardStatistics' + $ref: '../schemas/_common.yaml#/components/schemas/ShardStatistics' creation_time: type: integer format: int64 @@ -2944,7 +2897,7 @@ components: pits: type: array items: - $ref: '../schemas/_core._common.yaml#/components/schemas/PitsDetailsDeleteAll' + $ref: '../schemas/_core.pit.yaml#/components/schemas/DeletedPit' delete_by_query@200: content: application/json: @@ -2969,7 +2922,7 @@ components: pits: type: array items: - $ref: '../schemas/_core._common.yaml#/components/schemas/DeletedPit' + $ref: '../schemas/_core.pit.yaml#/components/schemas/DeletedPit' delete_script@200: content: application/json: @@ -3045,7 +2998,7 @@ components: pits: type: array items: - $ref: '../schemas/_core._common.yaml#/components/schemas/PitDetail' + $ref: '../schemas/_core.pit.yaml#/components/schemas/PitDetail' get_script@200: content: application/json: @@ -3191,8 +3144,7 @@ components: $ref: '../schemas/_core.rank_eval.yaml#/components/schemas/RankEvalMetricDetail' failures: type: object - additionalProperties: - type: object + additionalProperties: true required: - details - failures @@ -3227,8 +3179,7 @@ components: properties: template_output: type: object - additionalProperties: - type: object + additionalProperties: true required: - template_output scripts_painless_execute@200: @@ -3953,10 +3904,7 @@ components: description: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. style: form schema: - type: array - items: - type: string - description: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + $ref: '../schemas/_core.search.yaml#/components/schemas/SourceConfigParam' explode: true delete_by_query::query._source_excludes: name: _source_excludes @@ -5341,6 +5289,11 @@ components: format: float default: 0 style: form + reindex::query.require_alias: + in: query + name: require_alias + schema: + type: boolean reindex::query.scroll: in: query name: scroll @@ -6295,10 +6248,7 @@ components: description: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. style: form schema: - type: array - items: - type: string - description: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + $ref: '../schemas/_core.search.yaml#/components/schemas/SourceConfigParam' explode: true update_by_query::query._source_excludes: name: _source_excludes diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 6491758db..9f9a838eb 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -444,10 +444,13 @@ components: VersionString: type: string SearchType: - type: string - enum: - - dfs_query_then_fetch - - query_then_fetch + oneOf: + - type: string + const: dfs_query_then_fetch + description: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate. + - type: string + const: query_then_fetch + description: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate. SuggestMode: type: string enum: @@ -752,7 +755,8 @@ components: field: $ref: '#/components/schemas/Field' id: - $ref: '#/components/schemas/Id' + type: integer + format: int32 max: type: integer format: int32 @@ -1573,8 +1577,11 @@ components: Slices: description: The slice configuration used to parallelize a process. oneOf: - - type: number - - $ref: '#/components/schemas/SlicesCalculation' + - title: count + type: integer + format: int32 + - title: calculation + $ref: '#/components/schemas/SlicesCalculation' SlicesCalculation: type: string enum: @@ -2218,7 +2225,8 @@ components: node: $ref: '#/components/schemas/NodeName' shard: - type: number + type: integer + format: int32 index: $ref: '#/components/schemas/IndexName' allocation_id: @@ -2235,20 +2243,11 @@ components: oneOf: - $ref: '#/components/schemas/NodeId' - type: 'null' - relocation_failure_info: - $ref: '#/components/schemas/RelocationFailureInfo' required: - index - primary - shard - state - RelocationFailureInfo: - type: object - properties: - failed_attempts: - type: number - required: - - failed_attempts OpenSearchVersionInfo: type: object properties: diff --git a/spec/schemas/_core._common.yaml b/spec/schemas/_core._common.yaml deleted file mode 100644 index 4b1690c7e..000000000 --- a/spec/schemas/_core._common.yaml +++ /dev/null @@ -1,48 +0,0 @@ -openapi: 3.1.0 -info: - title: Schemas of `_core._common` Category - description: Schemas of `_core._common` category. - version: 1.0.0 -paths: {} -components: - schemas: - DeletedPit: - type: object - properties: - successful: - type: boolean - pit_id: - type: string - PitsDetailsDeleteAll: - type: object - properties: - successful: - type: boolean - pit_id: - type: string - PitDetail: - type: object - properties: - pit_id: - type: string - creation_time: - type: integer - format: int64 - keep_alive: - type: integer - format: int64 - ShardStatistics: - type: object - properties: - total: - type: integer - format: int32 - successful: - type: integer - format: int32 - skipped: - type: integer - format: int32 - failed: - type: integer - format: int32 diff --git a/spec/schemas/_core.field_caps.yaml b/spec/schemas/_core.field_caps.yaml index 3a0d4a589..c046654e5 100644 --- a/spec/schemas/_core.field_caps.yaml +++ b/spec/schemas/_core.field_caps.yaml @@ -15,7 +15,11 @@ components: indices: $ref: '_common.yaml#/components/schemas/Indices' meta: - $ref: '_common.yaml#/components/schemas/Metadata' + type: object + additionalProperties: + type: array + items: + type: string non_aggregatable_indices: $ref: '_common.yaml#/components/schemas/Indices' non_searchable_indices: diff --git a/spec/schemas/_core.mtermvectors.yaml b/spec/schemas/_core.mtermvectors.yaml index 503dccafb..7b8e36a65 100644 --- a/spec/schemas/_core.mtermvectors.yaml +++ b/spec/schemas/_core.mtermvectors.yaml @@ -15,7 +15,6 @@ components: $ref: '_common.yaml#/components/schemas/IndexName' doc: description: An artificial document for which you want to retrieve term vectors. - type: object fields: $ref: '_common.yaml#/components/schemas/Fields' field_statistics: @@ -53,7 +52,8 @@ components: _version: $ref: '_common.yaml#/components/schemas/VersionNumber' took: - type: number + type: integer + format: int64 found: type: boolean term_vectors: diff --git a/spec/schemas/_core.pit.yaml b/spec/schemas/_core.pit.yaml new file mode 100644 index 000000000..883ecb0d8 --- /dev/null +++ b/spec/schemas/_core.pit.yaml @@ -0,0 +1,26 @@ +openapi: 3.1.0 +info: + title: Schemas of `_core.pit` Category + description: Schemas of `_core.pit` category. + version: 1.0.0 +paths: {} +components: + schemas: + DeletedPit: + type: object + properties: + successful: + type: boolean + pit_id: + type: string + PitDetail: + type: object + properties: + pit_id: + type: string + creation_time: + type: integer + format: int64 + keep_alive: + type: integer + format: int64 diff --git a/spec/schemas/_core.rank_eval.yaml b/spec/schemas/_core.rank_eval.yaml index 436d271ea..3628482da 100644 --- a/spec/schemas/_core.rank_eval.yaml +++ b/spec/schemas/_core.rank_eval.yaml @@ -23,8 +23,7 @@ components: params: description: The search template parameters. type: object - additionalProperties: - type: object + additionalProperties: true required: - id - ratings @@ -34,7 +33,8 @@ components: query: $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' size: - type: number + type: integer + format: int32 required: - query DocumentRating: @@ -46,7 +46,8 @@ components: $ref: '_common.yaml#/components/schemas/IndexName' rating: description: The document's relevance with regard to the specified search request. - type: number + type: integer + format: int32 required: - _id - _index @@ -79,13 +80,15 @@ components: properties: relevant_rating_threshold: description: Sets the rating threshold above which documents are considered to be relevant. - type: number + type: integer + format: int32 RankEvalMetricBase: type: object properties: k: description: Sets the maximum number of documents retrieved per query. This value replaces the `size` parameter in the query. - type: number + type: integer + format: int32 RankEvalMetricRecall: allOf: - $ref: '#/components/schemas/RankEvalMetricRatingThreshold' @@ -109,7 +112,8 @@ components: properties: maximum_relevance: description: The highest relevance grade used in user-supplied relevance judgments. - type: number + type: integer + format: int32 required: - maximum_relevance RankEvalMetricDetail: @@ -118,6 +122,7 @@ components: metric_score: description: The `metric_score`, found in the `metric_details` section, shows the contribution of this query to the global quality metric score. type: number + format: double unrated_docs: description: The `unrated_docs` section contains an `_index` and `_id` entry for each document that didn't have a `ratings` value. This can be used to ask the user to supply ratings for these documents. type: array @@ -133,8 +138,7 @@ components: type: object additionalProperties: type: object - additionalProperties: - type: number + additionalProperties: true required: - hits - metric_details @@ -156,7 +160,8 @@ components: hit: $ref: '#/components/schemas/RankEvalHit' rating: - type: ['null', number, string] + type: integer + format: int32 required: - hit RankEvalHit: @@ -168,6 +173,7 @@ components: $ref: '_common.yaml#/components/schemas/IndexName' _score: type: number + format: double _type: $ref: '_common.yaml#/components/schemas/Type' required: diff --git a/spec/schemas/_core.reindex.yaml b/spec/schemas/_core.reindex.yaml index 34fdbe13e..2ceef38e0 100644 --- a/spec/schemas/_core.reindex.yaml +++ b/spec/schemas/_core.reindex.yaml @@ -35,7 +35,8 @@ components: description: |- The number of documents to index per batch. Use the `size` setting when indexing from a remote cluster. This ensures that batches fit in the on-heap buffer. The buffer defaults to a maximum size of `100MB`. - type: number + type: integer + format: int32 slice: $ref: '_common.yaml#/components/schemas/SlicedScroll' sort: diff --git a/spec/schemas/_core.reindex_rethrottle.yaml b/spec/schemas/_core.reindex_rethrottle.yaml index bc5ce3a8a..0f0b0d1e1 100644 --- a/spec/schemas/_core.reindex_rethrottle.yaml +++ b/spec/schemas/_core.reindex_rethrottle.yaml @@ -29,7 +29,8 @@ components: description: type: string id: - type: number + type: integer + format: int64 node: $ref: '_common.yaml#/components/schemas/Name' resource_stats: @@ -60,19 +61,24 @@ components: properties: batches: description: The number of scroll responses shown by the reindex. - type: number + type: integer + format: int64 created: description: The number of documents that were successfully created. - type: number + type: integer + format: int64 deleted: description: The number of documents that were successfully deleted. - type: number + type: integer + format: int64 noops: description: The number of documents that were ignored because the script used for the reindex operation returned a `noop` value for `ctx.op`. - type: number + type: integer + format: int64 requests_per_second: description: The number of successful requests per second during the reindex operation. type: number + format: float retries: $ref: '_common.yaml#/components/schemas/Retries' throttled: @@ -85,13 +91,16 @@ components: $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' total: description: The number of documents that were successfully processed. - type: number + type: integer + format: int64 updated: description: The number of documents that were successfully updated. - type: number + type: integer + format: int64 version_conflicts: description: The number of version conflicts that reindex hits. - type: number + type: integer + format: int64 required: - batches - created diff --git a/spec/schemas/_core.search.yaml b/spec/schemas/_core.search.yaml index 1dbef6a1d..5183f28c8 100644 --- a/spec/schemas/_core.search.yaml +++ b/spec/schemas/_core.search.yaml @@ -651,8 +651,10 @@ components: Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered. Use this setting with the `_source_includes` and `_source_excludes` parameters. oneOf: - - type: boolean - - $ref: '_common.yaml#/components/schemas/Fields' + - title: fetch + type: boolean + - title: fields + $ref: '_common.yaml#/components/schemas/Fields' InnerHits: type: object properties: diff --git a/spec/schemas/_core.termvectors.yaml b/spec/schemas/_core.termvectors.yaml index 1b6d0a8c8..24d73fdfd 100644 --- a/spec/schemas/_core.termvectors.yaml +++ b/spec/schemas/_core.termvectors.yaml @@ -13,33 +13,40 @@ components: description: |- Ignores words that appear in more than the specified number of documents. Default is `unbounded`. - type: number + type: integer + format: int32 max_num_terms: description: The maximum number of terms that should be returned per field. - type: number + type: integer + format: int32 max_term_freq: description: |- Ignore words with more than this frequency in the source doc. Default is `unbounded`. - type: number + type: integer + format: int32 max_word_length: description: |- The maximum word length. Words longer than this value will be ignored. Default is `unbounded`. - type: number + type: integer + format: int32 min_doc_freq: description: Ignore terms which do not occur in at least this many docs. - type: number + type: integer + format: int32 min_term_freq: description: Ignore words with less than this frequency in the source doc. - type: number + type: integer + format: int32 min_word_length: description: |- The minimum word length. Words shorter than this value will be ignored. Default is 0. - type: number + type: integer + format: int32 TermVector: type: object properties: @@ -50,17 +57,19 @@ components: additionalProperties: $ref: '#/components/schemas/Term' required: - - field_statistics - terms FieldStatistics: type: object properties: doc_count: - type: number + type: integer + format: int32 sum_doc_freq: - type: number + type: integer + format: int64 sum_ttf: - type: number + type: integer + format: int64 required: - doc_count - sum_doc_freq @@ -69,29 +78,36 @@ components: type: object properties: doc_freq: - type: number + type: integer + format: int32 score: type: number + format: double term_freq: - type: number + type: integer + format: int32 tokens: type: array items: $ref: '#/components/schemas/Token' ttf: - type: number + type: integer + format: int32 required: - term_freq Token: type: object properties: end_offset: - type: number + type: integer + format: int32 payload: type: string position: - type: number + type: integer + format: int32 start_offset: - type: number + type: integer + format: int32 required: - position diff --git a/tests/default/_core/search_shards.yaml b/tests/default/_core/search_shards.yaml index 318a6d234..a592208aa 100644 --- a/tests/default/_core/search_shards.yaml +++ b/tests/default/_core/search_shards.yaml @@ -22,16 +22,5 @@ chapters: - synopsis: Verify the distribution of shards for the index. path: /_search_shards method: GET - response: - status: 200 - - - synopsis: Check routing behavior based on search criteria. - path: /_search_shards - method: POST - request: - payload: - query: - match: - title: To Kill a Mockingbird response: status: 200 \ No newline at end of file diff --git a/tests/default/indices/search_shards.yaml b/tests/default/indices/search_shards.yaml index bcb755962..01472073a 100644 --- a/tests/default/indices/search_shards.yaml +++ b/tests/default/indices/search_shards.yaml @@ -24,18 +24,5 @@ chapters: parameters: index: movies method: GET - response: - status: 200 - - - synopsis: Check routing behavior based on search criteria. - path: /{index}/_search_shards - parameters: - index: movies - method: POST - request: - payload: - query: - match: - title: To Kill a Mockingbird response: status: 200 \ No newline at end of file