From 478ddb8859691266dc0e53addd7e854a34be96d5 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 20 Nov 2024 16:38:45 +1300 Subject: [PATCH 1/6] Correct index settings types Signed-off-by: Thomas Farr --- spec/schemas/_common.analysis.yaml | 24 +-- spec/schemas/_common.yaml | 18 +- spec/schemas/indices._common.yaml | 283 +++++++++++++++++++++------- tests/default/indices/settings.yaml | 16 +- tools/src/merger/OpenApiMerger.ts | 16 -- 5 files changed, 253 insertions(+), 104 deletions(-) diff --git a/spec/schemas/_common.analysis.yaml b/spec/schemas/_common.analysis.yaml index fb332dffe..dfa6e9a6d 100644 --- a/spec/schemas/_common.analysis.yaml +++ b/spec/schemas/_common.analysis.yaml @@ -549,7 +549,7 @@ components: enum: - asciifolding preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - type TokenFilterBase: @@ -634,7 +634,7 @@ components: side: $ref: '#/components/schemas/EdgeNGramSide' preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - type EdgeNGramSide: @@ -658,7 +658,7 @@ components: articles_path: type: string articles_case: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - type FingerprintTokenFilter: @@ -828,7 +828,7 @@ components: consume_all_tokens: type: boolean max_token_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' required: - type LowercaseTokenFilter: @@ -858,7 +858,7 @@ components: items: type: string preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - filters - type @@ -876,7 +876,7 @@ components: min_gram: type: integer preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - type NoriPartOfSpeechTokenFilter: @@ -908,7 +908,7 @@ components: items: type: string preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - patterns - type @@ -1211,7 +1211,7 @@ components: ignore_keywords: type: boolean preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' protected_words: type: array items: @@ -1252,7 +1252,7 @@ components: generate_word_parts: type: boolean preserve_original: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' protected_words: type: array items: @@ -1736,15 +1736,15 @@ components: enum: - path_hierarchy buffer_size: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' delimiter: type: string replacement: type: string reverse: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' skip: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' required: - buffer_size - delimiter diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 45d8e901f..69e77986e 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -43,7 +43,7 @@ components: description: |- A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. - pattern: ^([0-9\.]+)(?:d|h|m|s|ms|micros|nanos)$ + pattern: ^(?:(-1)|([0-9\.]+)(?:d|h|m|s|ms|micros|nanos))$ type: string Metadata: type: object @@ -822,7 +822,7 @@ components: type: string HumanReadableByteCount: type: string - pattern: '\d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p)' + pattern: '(?:(-1)|(0)|\d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p))' ByteUnit: type: string enum: @@ -921,7 +921,7 @@ components: $ref: '#/components/schemas/ScrollId' TransportAddress: type: string - Stringifiedinteger: + StringifiedInteger: description: |- Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures this behavior while keeping the semantics of the field type. @@ -931,7 +931,17 @@ components: oneOf: - type: integer - type: string - Stringifiedboolean: + StringifiedLong: + oneOf: + - type: integer + format: int64 + - type: string + StringifiedDouble: + oneOf: + - type: number + format: double + - type: string + StringifiedBoolean: description: |- Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures this behavior while keeping the semantics of the field type. diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index a9b4b7614..5c11fcfaf 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -27,31 +27,27 @@ components: sort: $ref: '#/components/schemas/IndexSegmentSort' number_of_shards: - oneOf: - - type: integer - - type: string + $ref: '_common.yaml#/components/schemas/StringifiedInteger' number_of_replicas: - oneOf: - - type: integer - - type: string + $ref: '_common.yaml#/components/schemas/StringifiedInteger' number_of_routing_shards: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' check_on_startup: $ref: '#/components/schemas/IndexCheckOnStartup' codec: type: string routing_partition_size: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' load_fixed_bitset_filters_eagerly: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' hidden: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' auto_expand_replicas: type: string merge: $ref: '#/components/schemas/IndexSettingsMerge' merge.scheduler.max_thread_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' search: $ref: '#/components/schemas/IndexSettingsSearch' search.idle.after: @@ -59,45 +55,45 @@ components: refresh_interval: $ref: '_common.yaml#/components/schemas/Duration' max_result_window: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_inner_result_window: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_rescore_window: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_docvalue_fields_search: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_script_fields: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_ngram_diff: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_shingle_diff: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' blocks: $ref: '#/components/schemas/IndexSettingBlocks' blocks.read_only: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' blocks.read_only_allow_delete: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' blocks.read: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' blocks.write: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' blocks.metadata: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' max_refresh_listeners: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' analyze: $ref: '#/components/schemas/IndexSettingsAnalyze' analyze.max_token_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' highlight: $ref: '#/components/schemas/IndexSettingsHighlight' highlight.max_analyzed_offset: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_terms_count: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_regex_length: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' routing: $ref: '#/components/schemas/IndexRouting' gc_deletes: @@ -121,13 +117,13 @@ components: version: $ref: '#/components/schemas/IndexVersioning' verified_before_close: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' format: oneOf: - type: string - type: number max_slices_per_scroll: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' translog: $ref: '#/components/schemas/Translog' translog.durability: @@ -137,13 +133,13 @@ components: query_string: $ref: '#/components/schemas/IndexSettingsQueryString' query_string.lenient: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' priority: oneOf: - type: number - type: string top_metrics_max_size: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' analysis: $ref: '#/components/schemas/IndexSettingsAnalysis' settings: @@ -161,9 +157,11 @@ components: store: $ref: '#/components/schemas/IndexSettingsStore' knn: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' knn.algo_param.ef_search: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + composite_index.star_tree: + $ref: '#/components/schemas/IndexSettingsStarTree' additionalProperties: title: custom_settings IndexSettingsIndexing: @@ -176,9 +174,16 @@ components: properties: enabled: description: Indicates whether soft deletes are enabled on the index. - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' + retention: + $ref: '#/components/schemas/SoftDeletesRetention' retention_lease: $ref: '#/components/schemas/RetentionLease' + SoftDeletesRetention: + type: object + properties: + operations: + $ref: '_common.yaml#/components/schemas/StringifiedLong' RetentionLease: type: object properties: @@ -233,22 +238,83 @@ components: IndexSettingsMerge: type: object properties: + log_byte_size_policy: + $ref: '#/components/schemas/IndexSettingsMergeLogByteSizePolicy' + policy: + $ref: '#/components/schemas/IndexSettingsMergePolicy' + policy.deletes_pct_allowed: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + policy.expunge_deletes_allowed: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + policy.floor_segment: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + policy.max_merge_at_once: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + policy.max_merged_segment: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + policy.reclaim_deletes_weight: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + policy.segments_per_tier: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' scheduler: $ref: '#/components/schemas/IndexSettingsMergeScheduler' IndexSettingsMergeScheduler: type: object properties: + auto_throttle: + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' max_thread_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' max_merge_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + IndexSettingsMergePolicy: + type: string + enum: + - tiered + - log_byte_size + - default + IndexSettingsMergeLogByteSizePolicy: + type: object + properties: + max_merge_segment: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + max_merge_segment_forced_merge: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + max_merged_docs: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + merge_factor: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + min_merge: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + no_cfs_ratio: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' IndexSettingsSearch: type: object properties: + concurrent: + $ref: '#/components/schemas/IndexSettingsSearchConcurrent' + concurrent_segment_search: + $ref: '#/components/schemas/IndexSettingsSearchConcurrentSegmentSearch' + default_pipeline: + type: string idle: $ref: '#/components/schemas/SearchIdle' slowlog: $ref: '#/components/schemas/SearchSlowlog' + throttled: + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' + IndexSettingsSearchConcurrent: + type: object + properties: + max_slice_count: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + IndexSettingsSearchConcurrentSegmentSearch: + type: object + properties: + mode: + type: string + enabled: + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' SearchIdle: type: object properties: @@ -285,25 +351,25 @@ components: type: object properties: read_only: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' read_only_allow_delete: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' read: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' write: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' metadata: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' IndexSettingsAnalyze: type: object properties: max_token_count: - $ref: '_common.yaml#/components/schemas/Stringifiedinteger' + $ref: '_common.yaml#/components/schemas/StringifiedInteger' IndexSettingsHighlight: type: object properties: max_analyzed_offset: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' IndexRouting: type: object properties: @@ -322,6 +388,8 @@ components: $ref: '#/components/schemas/IndexRoutingAllocationInitialRecovery' disk: $ref: '#/components/schemas/IndexRoutingAllocationDisk' + total_shards_per_node: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' IndexRoutingAllocationOptions: type: string enum: @@ -345,7 +413,7 @@ components: type: object properties: threshold_enabled: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' IndexRoutingRebalance: type: object properties: @@ -366,7 +434,7 @@ components: name: $ref: '_common.yaml#/components/schemas/Name' indexing_complete: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' origination_date: description: |- If specified, this is the timestamp used to calculate the index age for its phase transitions. Use this setting @@ -411,6 +479,8 @@ components: $ref: '#/components/schemas/TranslogDurability' flush_threshold_size: $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + generation_threshold_size: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' retention: $ref: '#/components/schemas/TranslogRetention' TranslogDurability: @@ -431,7 +501,7 @@ components: type: object properties: lenient: - $ref: '_common.yaml#/components/schemas/Stringifiedboolean' + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' IndexSettingsAnalysis: type: object properties: @@ -464,7 +534,7 @@ components: type: object properties: enabled: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' required: - enabled IndexSettingsSimilarity: @@ -594,7 +664,7 @@ components: type: object properties: coerce: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' total_fields: $ref: '#/components/schemas/IndexSettingsMappingLimitTotalFields' depth: @@ -608,7 +678,7 @@ components: dimension_fields: $ref: '#/components/schemas/IndexSettingsMappingLimitDimensionFields' ignore_malformed: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' IndexSettingsMappingLimitTotalFields: type: object properties: @@ -617,8 +687,7 @@ components: The maximum number of fields in an index. Field and object mappings, as well as field aliases count towards this limit. The limit is in place to prevent mappings and searches from becoming too large. Higher values can lead to performance degradations and memory issues, especially in clusters with a high load or few resources. - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexSettingsMappingLimitDepth: type: object properties: @@ -626,8 +695,7 @@ components: description: |- The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined at the root object level, then the depth is `1`. If there is one object mapping, then the depth is `2`. - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexSettingsMappingLimitNestedFields: type: object properties: @@ -636,8 +704,7 @@ components: The maximum number of distinct nested mappings in an index. The nested type should only be used in special cases, when arrays of objects need to be queried independently of each other. To safeguard against poorly designed mappings, this setting limits the number of unique nested types per index. - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexSettingsMappingLimitNestedObjects: type: object properties: @@ -645,8 +712,7 @@ components: description: |- The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexSettingsMappingLimitFieldNameLength: type: object properties: @@ -655,8 +721,7 @@ components: Setting for the maximum length of a field name. This setting isn't really something that addresses mappings explosion but might still be useful if you want to limit the field length. It usually shouldn't be necessary to set this setting. The default is okay unless a user starts to add a huge number of fields with really long names. Default is `Long.MAX_VALUE` (no limit). - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexSettingsMappingLimitDimensionFields: type: object properties: @@ -664,17 +729,16 @@ components: description: |- [preview] This functionality is in technical preview and may be changed or removed in a future release. OpenSearch will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. - type: integer - format: int64 + $ref: '_common.yaml#/components/schemas/StringifiedLong' IndexingSlowlog: type: object properties: level: type: string source: - type: integer + $ref: '_common.yaml#/components/schemas/StringifiedInteger' reformat: - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' threshold: $ref: '#/components/schemas/IndexingSlowlogThresholds' IndexingSlowlogThresholds: @@ -712,16 +776,95 @@ components: This is a Boolean setting indicating whether or not memory-mapping is allowed. The default is to allow it. This setting is useful, for example, if you are in an environment where you can not control the ability to create a lot of memory maps so you need disable the ability to use memory-mapping. - type: boolean + $ref: '_common.yaml#/components/schemas/StringifiedBoolean' + fs: + $ref: '#/components/schemas/IndexSettingsStoreFs' + hybrid: + $ref: '#/components/schemas/IndexSettingsStoreHybrid' + preload: + type: array + items: + type: string + stats_refresh_interval: + $ref: '_common.yaml#/components/schemas/Duration' required: - type - StorageType: + IndexSettingsStoreFs: + type: object + properties: + fs_lock: + $ref: '#/components/schemas/IndexSettingsStoreFsLock' + IndexSettingsStoreFsLock: type: string enum: - - fs - - hybridfs - - mmapfs - - niofs + - native + - simple + IndexSettingsStoreHybrid: + type: object + properties: + mmap: + $ref: '#/components/schemas/IndexSettingsStoreHybridMmap' + nio: + $ref: '#/components/schemas/IndexSettingsStoreHybridNio' + IndexSettingsStoreHybridMmap: + type: object + properties: + extensions: + type: array + items: + type: string + IndexSettingsStoreHybridNio: + type: object + properties: + extensions: + type: array + items: + type: string + StorageType: + anyOf: + - type: string + enum: + - fs + - hybridfs + - mmapfs + - niofs + - type: string + IndexSettingsStarTree: + type: object + properties: + default: + $ref: '#/components/schemas/IndexSettingsStarTreeDefault' + field: + $ref: '#/components/schemas/IndexSettingsStarTreeField' + max_fields: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + IndexSettingsStarTreeDefault: + type: object + properties: + max_leaf_docs: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + IndexSettingsStarTreeField: + type: object + properties: + default: + $ref: '#/components/schemas/IndexSettingsStarTreeFieldDefault' + max_base_metrics: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + max_date_intervals: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + max_dimensions: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + IndexSettingsStarTreeFieldDefault: + type: object + properties: + date_intervals: + type: array + items: + type: string + metrics: + type: array + items: + type: string NumericFielddata: type: object properties: diff --git a/tests/default/indices/settings.yaml b/tests/default/indices/settings.yaml index c7349ede8..8513ffaa6 100644 --- a/tests/default/indices/settings.yaml +++ b/tests/default/indices/settings.yaml @@ -85,5 +85,17 @@ chapters: index: blocks: write: 'true' - - + - synopsis: Get settings for an index including all default values. + path: /{index}/_settings + method: GET + parameters: + index: movies + include_defaults: true + response: + status: 200 + payload: + movies: + defaults: + index: + store: + type: '' diff --git a/tools/src/merger/OpenApiMerger.ts b/tools/src/merger/OpenApiMerger.ts index 9ea66265d..cb1916e61 100644 --- a/tools/src/merger/OpenApiMerger.ts +++ b/tools/src/merger/OpenApiMerger.ts @@ -54,7 +54,6 @@ export default class OpenApiMerger { this.#merge_namespaces() this.#sort_spec_keys() this.#add_defaults() - this.#fix_refs() this.#generate_global_params() this.#generate_superseded_ops() this.#normalize_fields() @@ -137,21 +136,6 @@ export default class OpenApiMerger { }) } - #fix_refs(obj: any = this._spec.components): void { - if (obj?.$ref !== undefined) { - if (obj?.description !== undefined) { - delete obj?.description - } - } - - for (const key in obj) { - var item = obj[key] - if (_.isObject(item) || _.isArray(item)) { - this.#fix_refs(item) - } - } - } - #normalize_key(key: string): string { return key .replaceAll('::', '___') From 18bc7ee303e2c8355de25ede9d74c7596ffd89a3 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 20 Nov 2024 16:42:51 +1300 Subject: [PATCH 2/6] lint fix Signed-off-by: Thomas Farr --- spec/schemas/_common.yaml | 8 ++++---- spec/schemas/indices._common.yaml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 69e77986e..0ae9e8db3 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -937,10 +937,10 @@ components: format: int64 - type: string StringifiedDouble: - oneOf: - - type: number - format: double - - type: string + oneOf: + - type: number + format: double + - type: string StringifiedBoolean: description: |- Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index 5c11fcfaf..898dfb4a8 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -270,9 +270,9 @@ components: IndexSettingsMergePolicy: type: string enum: - - tiered - - log_byte_size - default + - log_byte_size + - tiered IndexSettingsMergeLogByteSizePolicy: type: object properties: From 003734f843c7b1195f6cc5690832c0bc489928af Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 21 Nov 2024 14:21:28 +1300 Subject: [PATCH 3/6] Don't fail-fast on test spec Signed-off-by: Thomas Farr --- .github/workflows/test-spec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 8bc1abeea..e8c60ff16 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -21,6 +21,7 @@ on: jobs: test-opensearch-spec: strategy: + fail-fast: false matrix: entry: - version: 1.3.17 From cc716d3d5e8e6f73879ff69025e4c9a6c7d4eab6 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 21 Nov 2024 15:01:25 +1300 Subject: [PATCH 4/6] Fix tests Signed-off-by: Thomas Farr --- spec/schemas/indices._common.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index 898dfb4a8..38e2518eb 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -268,11 +268,34 @@ components: max_merge_count: $ref: '_common.yaml#/components/schemas/StringifiedInteger' IndexSettingsMergePolicy: + oneOf: + - title: name + $ref: '#/components/schemas/IndexSettingsMergePolicyName' + - title: tiered_policy_config + $ref: '#/components/schemas/IndexSettingsMergeTieredPolicy' + IndexSettingsMergePolicyName: type: string enum: - default - log_byte_size - tiered + IndexSettingsMergeTieredPolicy: + type: object + properties: + deletes_pct_allowed: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + expunge_deletes_allowed: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + floor_segment: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + max_merge_at_once: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + max_merged_segment: + $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' + reclaim_deletes_weight: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' + segments_per_tier: + $ref: '_common.yaml#/components/schemas/StringifiedDouble' IndexSettingsMergeLogByteSizePolicy: type: object properties: From 4cc1ae6061b3b5eeb25a4c3e409e867c6e05bc29 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 21 Nov 2024 15:10:09 +1300 Subject: [PATCH 5/6] Fix tests Signed-off-by: Thomas Farr --- spec/schemas/indices._common.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index 38e2518eb..2f08e5827 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -290,6 +290,9 @@ components: $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' max_merge_at_once: $ref: '_common.yaml#/components/schemas/StringifiedInteger' + max_merge_at_once_explicit: + $ref: '_common.yaml#/components/schemas/StringifiedInteger' + x-version-removed: '2.0' max_merged_segment: $ref: '_common.yaml#/components/schemas/HumanReadableByteCount' reclaim_deletes_weight: From 48d134bac2426ed2f74b5cb2e7bcd32ae5cdd690 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 21 Nov 2024 15:28:56 +1300 Subject: [PATCH 6/6] changelog Signed-off-by: Thomas Farr --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f34eaec5a..a325ff081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed `ml._common.yaml#SearchModelsResponse` and `SearchModelsHitsHit` ([#672](https://github.com/opensearch-project/opensearch-api-specification/pull/672)) - Fixed `refresh` options to allow `boolean` and `string` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673)) - Fixed `value` type in `ExplanationDetail` and added `_type` to `explain@200` ([#685](https://github.com/opensearch-project/opensearch-api-specification/pull/685)) +- Fixed index settings types ([#684](https://github.com/opensearch-project/opensearch-api-specification/pull/684)) ### 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))