From df458ba38734744fc5bffc3e3558bbb0c386e051 Mon Sep 17 00:00:00 2001 From: amberzsy Date: Sun, 13 Oct 2024 04:44:23 +0000 Subject: [PATCH 1/3] update with accurate numeric type for common, core Signed-off-by: amberzsy --- spec/schemas/_common.query_dsl.yaml | 3 +- spec/schemas/_common.yaml | 65 +++-- spec/schemas/_core.bulk.yaml | 12 +- spec/schemas/_core.search.yaml | 244 ++++++++++++------ spec/schemas/asynchronous_search._common.yaml | 3 +- 5 files changed, 225 insertions(+), 102 deletions(-) diff --git a/spec/schemas/_common.query_dsl.yaml b/spec/schemas/_common.query_dsl.yaml index 872ecc039..070d84ce8 100644 --- a/spec/schemas/_common.query_dsl.yaml +++ b/spec/schemas/_common.query_dsl.yaml @@ -1824,7 +1824,8 @@ components: description: Can only be used as a clause in a span_near query. type: object additionalProperties: - type: number + type: integer + format: int32 minProperties: 1 maxProperties: 1 SpanMultiTermQuery: diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 9b3f07813..6f2b287d3 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -25,15 +25,20 @@ components: type: object properties: 1xx: - type: number + type: integer + format: int32 2xx: - type: number + type: integer + format: int32 3xx: - type: number + type: integer + format: int32 4xx: - type: number + type: integer + format: int32 5xx: - type: number + type: integer + format: int32 Duration: description: |- A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and @@ -162,6 +167,7 @@ components: type: array items: type: number + format: double - title: text type: string XyCartesianCoordinates: @@ -171,9 +177,11 @@ components: x: description: The x coordinate. type: number + format: double y: description: The y coordinate. type: number + format: double required: - x - y @@ -239,6 +247,7 @@ components: type: array items: type: number + format: double required: - coordinates - type @@ -246,17 +255,23 @@ components: type: object properties: skipped: - type: number + type: integer + format: int32 successful: - type: number + type: integer + format: int32 total: - type: number + type: integer + format: int32 running: - type: number + type: integer + format: int32 partial: - type: number + type: integer + format: int32 failed: - type: number + type: integer + format: int32 details: type: object additionalProperties: @@ -438,7 +453,8 @@ components: MinimumShouldMatch: description: The minimum number of terms that should match as an integer, percentage, or range. oneOf: - - type: number + - type: integer + format: int32 - type: string Distance: type: string @@ -512,7 +528,8 @@ components: Fuzziness: oneOf: - type: string - - type: number + - type: integer + format: int32 GeoDistanceType: type: string enum: @@ -631,6 +648,7 @@ components: $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' max_children: type: integer + format: int32 nested: $ref: '#/components/schemas/NestedSortValue' path: @@ -669,7 +687,8 @@ components: GeoHashPrecision: description: The level of geohash precision, which can be expressed as a geohash length between 1 and 12 or as a distance measure, such as "1km" or "10m". oneOf: - - type: number + - type: integer + format: int32 - type: string GeoTilePrecision: type: number @@ -682,14 +701,17 @@ components: $ref: '#/components/schemas/QueryVector' k: description: The total number of nearest neighbors to return as top hits. - type: number + type: integer + format: int32 min_score: description: The minimum similarity score required in order for a neighbor to be considered a hit. type: number + format: float x-version-added: '2.14' max_distance: description: The maximum physical vector space distance required in order for a neighbor to be considered a hit. type: number + format: float x-version-added: '2.14' filter: description: The filters for the k-NN search query. @@ -701,22 +723,26 @@ components: boost: description: The boost value applied to k-NN scores. type: number + format: float method_parameters: type: object x-version-added: '2.16' additionalProperties: - type: number + type: integer + format: int32 rescore: type: object x-version-added: '2.17' additionalProperties: type: number + format: float required: - vector QueryVector: type: array items: type: number + format: float SlicedScroll: type: object properties: @@ -725,7 +751,8 @@ components: id: $ref: '#/components/schemas/Id' max: - type: number + type: integer + format: int32 required: - id - max @@ -758,7 +785,8 @@ components: _seq_no: $ref: '#/components/schemas/SequenceNumber' _primary_term: - type: number + type: integer + format: int32 _routing: $ref: '#/components/schemas/Routing' _source: @@ -802,6 +830,7 @@ components: format: int64 PercentageNumber: type: number + format: double PercentageString: type: string pattern: '\d+(\.\d+)?' diff --git a/spec/schemas/_core.bulk.yaml b/spec/schemas/_core.bulk.yaml index 5db0782c8..92e0a9200 100644 --- a/spec/schemas/_core.bulk.yaml +++ b/spec/schemas/_core.bulk.yaml @@ -53,7 +53,8 @@ components: routing: $ref: '_common.yaml#/components/schemas/Routing' if_primary_term: - type: number + type: integer + format: int64 if_seq_no: $ref: '_common.yaml#/components/schemas/SequenceNumber' version: @@ -71,7 +72,8 @@ components: description: When `true`, the request's actions must target an index alias. type: boolean retry_on_conflict: - type: number + type: integer + format: int32 DeleteOperation: $ref: '#/components/schemas/OperationBase' UpdateAction: @@ -117,12 +119,14 @@ components: type: string status: description: HTTP status code returned for the operation. - type: number + type: integer + format: int32 error: $ref: '_common.yaml#/components/schemas/ErrorCause' _primary_term: description: The primary term assigned to the document for the operation. - type: number + type: integer + format: int64 result: description: |- Result of the operation. diff --git a/spec/schemas/_core.search.yaml b/spec/schemas/_core.search.yaml index 549c6f58e..a9d1f9077 100644 --- a/spec/schemas/_core.search.yaml +++ b/spec/schemas/_core.search.yaml @@ -13,7 +13,8 @@ components: description: Total hit count information, present only if `track_total_hits` wasn't `false` in the search request. oneOf: - $ref: '#/components/schemas/TotalHits' - - type: number + - type: integer + format: int64 hits: type: array items: @@ -28,7 +29,8 @@ components: relation: $ref: '#/components/schemas/TotalHitsRelation' value: - type: number + type: integer + format: int64 required: - relation - value @@ -91,7 +93,8 @@ components: _seq_no: $ref: '_common.yaml#/components/schemas/SequenceNumber' _primary_term: - type: number + type: integer + format: int64 _version: $ref: '_common.yaml#/components/schemas/VersionNumber' sort: @@ -112,7 +115,8 @@ components: field: $ref: '_common.yaml#/components/schemas/Field' offset: - type: number + type: integer + format: int32 _nested: $ref: '#/components/schemas/NestedIdentity' required: @@ -172,29 +176,41 @@ components: type: object properties: build_aggregation: - type: number + type: integer + format: int64 build_aggregation_count: - type: number + type: integer + format: int64 build_leaf_collector: - type: number + type: integer + format: int64 build_leaf_collector_count: - type: number + type: integer + format: int64 collect: - type: number + type: integer + format: int64 collect_count: - type: number + type: integer + format: int64 initialize: - type: number + type: integer + format: int64 initialize_count: - type: number + type: integer + format: int64 post_collection: - type: number + type: integer + format: int64 post_collection_count: - type: number + type: integer + format: int64 reduce: - type: number + type: integer + format: int64 reduce_count: - type: number + type: integer + format: int64 required: - build_aggregation - build_aggregation_count @@ -210,15 +226,19 @@ components: type: object properties: segments_with_multi_valued_ords: - type: number + type: integer + format: int32 collection_strategy: type: string segments_with_single_valued_ords: - type: number + type: integer + format: int32 total_buckets: - type: number + type: integer + format: int32 built_buckets: - type: number + type: integer + format: int32 result_strategy: type: string has_filter: @@ -228,58 +248,76 @@ components: delegate_debug: $ref: '#/components/schemas/AggregationProfileDebug' chars_fetched: - type: number + type: integer + format: int32 extract_count: - type: number + type: integer + format: int32 extract_ns: - type: number + type: integer + format: int32 values_fetched: - type: number + type: integer + format: int32 collect_analyzed_ns: - type: number + type: integer + format: int32 collect_analyzed_count: - type: number + type: integer + format: int32 surviving_buckets: - type: number + type: integer + format: int32 ordinals_collectors_used: - type: number + type: integer + format: int32 ordinals_collectors_overhead_too_high: - type: number + type: integer + format: int32 string_hashing_collectors_used: - type: number + type: integer + format: int32 numeric_collectors_used: - type: number + type: integer + format: int32 empty_collectors_used: - type: number + type: integer + format: int32 deferred_aggregators: type: array items: type: string segments_with_doc_count_field: - type: number + type: integer + format: int32 segments_with_deleted_docs: - type: number + type: integer + format: int32 filters: type: array items: $ref: '#/components/schemas/AggregationProfileDelegateDebugFilter' segments_counted: - type: number + type: integer + format: int32 segments_collected: - type: number + type: integer + format: int32 map_reducer: type: string AggregationProfileDelegateDebugFilter: type: object properties: results_from_metadata: - type: number + type: integer + format: int32 query: type: string specialized_for: type: string segments_counted_in_constant_time: - type: number + type: integer + format: int32 SearchProfile: type: object properties: @@ -292,7 +330,8 @@ components: items: $ref: '#/components/schemas/QueryProfile' rewrite_time: - type: number + type: integer + format: int64 required: - collector - query @@ -338,41 +377,59 @@ components: type: object properties: advance: - type: number + type: integer + format: int64 advance_count: - type: number + type: integer + format: int64 build_scorer: - type: number + type: integer + format: int64 build_scorer_count: - type: number + type: integer + format: int64 create_weight: - type: number + type: integer + format: int64 create_weight_count: - type: number + type: integer + format: int64 match: - type: number + type: integer + format: int64 match_count: - type: number + type: integer + format: int64 shallow_advance: - type: number + type: integer + format: int64 shallow_advance_count: - type: number + type: integer + format: int64 next_doc: - type: number + type: integer + format: int64 next_doc_count: - type: number + type: integer + format: int64 score: - type: number + type: integer + format: int64 score_count: - type: number + type: integer + format: int64 compute_max_score: - type: number + type: integer + format: int64 compute_max_score_count: - type: number + type: integer + format: int64 set_min_competitive_score: - type: number + type: integer + format: int64 set_min_competitive_score_count: - type: number + type: integer + format: int64 required: - advance - advance_count @@ -422,17 +479,23 @@ components: load_source_count: type: number load_stored_fields: - type: number + type: integer + format: int32 load_stored_fields_count: - type: number + type: integer + format: int32 next_reader: - type: number + type: integer + format: int32 next_reader_count: - type: number + type: integer + format: int32 process_count: - type: number + type: integer + format: int32 process: - type: number + type: integer + format: int32 FetchProfileDebug: type: object properties: @@ -441,7 +504,8 @@ components: items: type: string fast_path: - type: number + type: integer + format: int32 Suggest: oneOf: - $ref: '#/components/schemas/CompletionSuggest' @@ -483,12 +547,14 @@ components: $ref: '_common.yaml#/components/schemas/Routing' _score: type: number + format: float _source: type: object text: type: string score: type: number + format: float required: - text Context: @@ -500,9 +566,11 @@ components: type: object properties: length: - type: number + type: integer + format: int32 offset: - type: number + type: integer + format: int32 text: type: string required: @@ -529,6 +597,7 @@ components: type: string score: type: number + format: float highlighted: type: string collate_match: @@ -556,8 +625,10 @@ components: type: string score: type: number + format: float freq: type: number + format: double highlighted: type: string collate_match: @@ -574,7 +645,8 @@ components: Defaults to 10,000 hits. oneOf: - type: boolean - - type: number + - type: integer + format: int32 SourceConfigParam: description: |- Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered. @@ -590,9 +662,11 @@ components: size: description: The maximum number of hits to return per `inner_hits`. type: integer + format: int32 from: description: Inner hit starting document offset. type: integer + format: int32 collapse: $ref: '#/components/schemas/FieldCollapse' docvalue_fields: @@ -664,7 +738,8 @@ components: - type: object properties: fragment_offset: - type: number + type: integer + format: int32 matched_fields: $ref: '_common.yaml#/components/schemas/Fields' analyzer: @@ -679,7 +754,8 @@ components: type: string boundary_max_scan: description: How far to scan for boundary characters. - type: number + type: integer + format: int32 boundary_scanner: $ref: '#/components/schemas/BoundaryScanner' boundary_scanner_locale: @@ -694,22 +770,26 @@ components: $ref: '#/components/schemas/HighlighterFragmenter' fragment_size: description: The size of the highlighted fragment in characters. - type: number + type: integer + format: int32 highlight_filter: type: boolean highlight_query: $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' max_fragment_length: - type: number + type: integer + format: int32 max_analyzed_offset: description: |- If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed, thus not highlighted and no error is returned The `max_analyzed_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which prevails when it's set to lower value than the query setting. - type: number + type: integer + format: int32 no_match_size: description: The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight. - type: number + type: integer + format: int32 number_of_fragments: description: |- The maximum number of fragments to return. @@ -717,7 +797,8 @@ components: Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If `number_of_fragments` is `0`, `fragment_size` is ignored. - type: number + type: integer + format: int32 options: type: object additionalProperties: @@ -730,7 +811,8 @@ components: Prevents the `fvh` highlighter from analyzing too many phrases and consuming too much memory. When using `matched_fields`, `phrase_limit` phrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by the `fvh` highlighter. - type: number + type: integer + format: int32 post_tags: description: |- Use in conjunction with `pre_tags` to define the HTML tags to use for the highlighted text. @@ -807,7 +889,8 @@ components: query: $ref: '#/components/schemas/RescoreQuery' window_size: - type: number + type: integer + format: int32 required: - query RescoreQuery: @@ -818,9 +901,11 @@ components: query_weight: description: Relative importance of the original query versus the rescore query. type: number + format: float rescore_query_weight: description: Relative importance of the rescore query versus the original query. type: number + format: float score_mode: $ref: '#/components/schemas/ScoreMode' required: @@ -852,7 +937,8 @@ components: type: object properties: took: - type: number + type: integer + format: int64 timed_out: type: boolean _shards: @@ -874,8 +960,10 @@ components: type: object max_score: type: number + format: float num_reduce_phases: - type: number + type: integer + format: int32 profile: $ref: '#/components/schemas/Profile' pit_id: diff --git a/spec/schemas/asynchronous_search._common.yaml b/spec/schemas/asynchronous_search._common.yaml index 17765d9f0..691bf9ba9 100644 --- a/spec/schemas/asynchronous_search._common.yaml +++ b/spec/schemas/asynchronous_search._common.yaml @@ -134,7 +134,8 @@ components: When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. If set to `0` (default), the query does not terminate early. - type: number + type: integer + format: int32 timeout: description: |- Specifies the period of time to wait for a response from each shard. From 7e0b59492d23814eb780e5725fb6980f63e33255 Mon Sep 17 00:00:00 2001 From: amberzsy Date: Sun, 13 Oct 2024 07:00:33 +0000 Subject: [PATCH 2/3] add changelog Signed-off-by: amberzsy --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a7e05fb..98eddac78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -173,7 +173,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed create/delete/index operation in `_bulk` ([#582](https://github.com/opensearch-project/opensearch-api-specification/pull/582)) - Add `mode` and `compression` to k-NN index creation and search, and add `rescore` and `oversample_factor` to k-NN search ([#588](https://github.com/opensearch-project/opensearch-api-specification/pull/588)) - Fixed `/{index}/_search` with aggregations ([#576](https://github.com/opensearch-project/opensearch-api-specification/pull/576)) -- Fixed inaccurate numeric type ([#597](https://github.com/opensearch-project/opensearch-api-specification/pull/597))([#598](https://github.com/opensearch-project/opensearch-api-specification/pull/598))([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600)) +- Fixed inaccurate numeric type ([#597](https://github.com/opensearch-project/opensearch-api-specification/pull/597))([#598](https://github.com/opensearch-project/opensearch-api-specification/pull/598))([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600))([#612](https://github.com/opensearch-project/opensearch-api-specification/pull/612)) - Fixed mapping and analysis types ([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600)) - Fixed `RestStatus` responses in `DELETE /_plugins/_notifications/configs/{config_id}` ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594)) - Fixed `GET /_snapshot_/{repository}/{snapshot}` ([#608](https://github.com/opensearch-project/opensearch-api-specification/pull/608)) From f02d35626beaf485e4e02b32f01807b8a1026e6e Mon Sep 17 00:00:00 2001 From: amberzsy Date: Sun, 13 Oct 2024 07:35:35 +0000 Subject: [PATCH 3/3] update explian value field with 'General Number' Signed-off-by: amberzsy --- spec/schemas/_core.explain.yaml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/schemas/_core.explain.yaml b/spec/schemas/_core.explain.yaml index c0821a79b..f1e354551 100644 --- a/spec/schemas/_core.explain.yaml +++ b/spec/schemas/_core.explain.yaml @@ -16,7 +16,15 @@ components: items: $ref: '#/components/schemas/ExplanationDetail' value: - type: number + oneOf: + - type: integer + format: int32 + - type: integer + format: int64 + - type: number + format: float + - type: number + format: double required: - description - details @@ -31,7 +39,15 @@ components: items: $ref: '#/components/schemas/ExplanationDetail' value: - type: number + oneOf: + - type: integer + format: int32 + - type: integer + format: int64 + - type: number + format: float + - type: number + format: double required: - description - value