From b422a4af79d8ea9356ea6139a9406bca2f42647e Mon Sep 17 00:00:00 2001 From: nhtruong <644650+nhtruong@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:10:23 +0000 Subject: [PATCH] Updated opensearch-js to reflect the latest OpenSearch API spec (2024-12-22) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/_core/updateByQueryRethrottle.d.ts | 1 + api/_types/_common.d.ts | 10 +++++++--- api/_types/indices._common.d.ts | 12 ------------ api/_types/indices.shard_stores.d.ts | 4 ++-- api/indices/addBlock.d.ts | 3 +-- api/indices/clone.d.ts | 5 ++--- api/indices/close.d.ts | 3 +-- api/indices/rollover.d.ts | 5 ++--- api/indices/shardStores.d.ts | 2 +- api/indices/shrink.d.ts | 5 ++--- api/indices/split.d.ts | 3 +-- api/indices/upgrade.d.ts | 5 +++-- api/indices/upgrade.js | 1 - 13 files changed, 23 insertions(+), 36 deletions(-) diff --git a/api/_core/updateByQueryRethrottle.d.ts b/api/_core/updateByQueryRethrottle.d.ts index 400892133..e12357db7 100644 --- a/api/_core/updateByQueryRethrottle.d.ts +++ b/api/_core/updateByQueryRethrottle.d.ts @@ -29,6 +29,7 @@ export interface UpdateByQueryRethrottle_Response extends ApiResponse { } export type UpdateByQueryRethrottle_ResponseBody = { + node_failures?: Common.ErrorCause[]; nodes: Record; } diff --git a/api/_types/_common.d.ts b/api/_types/_common.d.ts index 1ebab654b..a6f9356e9 100644 --- a/api/_types/_common.d.ts +++ b/api/_types/_common.d.ts @@ -578,7 +578,7 @@ export type RemoteStoreUploadRefreshSizeLagStats = { export type RemoteStoreUploadStats = { max_refresh_time_lag?: Duration; max_refresh_time_lag_in_millis: DurationValueUnitMillis; - pressure: RemoteStoreUploadPressureStats; + pressure?: RemoteStoreUploadPressureStats; refresh_size_lag: RemoteStoreUploadRefreshSizeLagStats; total_time_spent?: Duration; total_time_spent_in_millis: DurationValueUnitMillis; @@ -707,8 +707,12 @@ export type SearchStats = { export type SearchType = 'dfs_query_then_fetch' | 'query_then_fetch' export type SegmentReplicationStats = { + max_bytes_behind: HumanReadableByteCount; + max_replication_lag: Duration; + total_bytes_behind: HumanReadableByteCount; +} | { max_bytes_behind: ByteCount; - max_replication_lag: ByteCount; + max_replication_lag: DurationValueUnitMillis; total_bytes_behind: ByteCount; } @@ -722,7 +726,7 @@ export type SegmentsStats = { index_writer_max_memory_in_bytes?: ByteCount; index_writer_memory?: HumanReadableByteCount; index_writer_memory_in_bytes: ByteCount; - max_unsafe_auto_id_timestamp: number; + max_unsafe_auto_id_timestamp: EpochTimeUnitMillis; memory?: HumanReadableByteCount; memory_in_bytes: ByteCount; norms_memory?: HumanReadableByteCount; diff --git a/api/_types/indices._common.d.ts b/api/_types/indices._common.d.ts index e9961154b..740814d3f 100644 --- a/api/_types/indices._common.d.ts +++ b/api/_types/indices._common.d.ts @@ -124,11 +124,6 @@ export type IndexingSlowlogThresholds = { index?: SlowlogThresholdLevels; } -export type IndexPostUpgradeStatus = { - _shards?: Common.ShardStatistics; - upgraded_indices?: Record; -} - export type IndexRouting = { allocation?: IndexRoutingAllocation; rebalance?: IndexRoutingRebalance; @@ -608,13 +603,6 @@ export type TranslogRetention = { size?: Common.HumanReadableByteCount; } -export type UpgradeRequest = { - allow_no_indices?: boolean; - expand_wildcards?: 'all' | 'closed' | 'none' | 'open'; - ignore_unavailable?: boolean; - wait_for_completion?: boolean; -} - export type UpgradeStatus = { size_in_bytes?: Common.ByteCount; size_to_upgrade_ancient_in_bytes?: Common.ByteCount; diff --git a/api/_types/indices.shard_stores.d.ts b/api/_types/indices.shard_stores.d.ts index 21bc61ea2..3a9aae341 100644 --- a/api/_types/indices.shard_stores.d.ts +++ b/api/_types/indices.shard_stores.d.ts @@ -34,9 +34,9 @@ export type ShardStoreException = { type: string; } +export type ShardStoreStatus = 'all' | 'green' | 'red' | 'yellow' + export type ShardStoreWrapper = { stores: ShardStore[]; } -export type Status = 'all' | 'green' | 'red' | 'yellow' - diff --git a/api/indices/addBlock.d.ts b/api/indices/addBlock.d.ts index 0f2199dd2..7af3c9e71 100644 --- a/api/indices/addBlock.d.ts +++ b/api/indices/addBlock.d.ts @@ -34,8 +34,7 @@ export interface Indices_AddBlock_Response extends ApiResponse { body: Indices_AddBlock_ResponseBody; } -export type Indices_AddBlock_ResponseBody = { - acknowledged: boolean; +export interface Indices_AddBlock_ResponseBody extends Common.AcknowledgedResponseBase { indices: Indices_AddBlock.IndicesBlockStatus[]; shards_acknowledged: boolean; } diff --git a/api/indices/clone.d.ts b/api/indices/clone.d.ts index e36121de8..156d04204 100644 --- a/api/indices/clone.d.ts +++ b/api/indices/clone.d.ts @@ -33,15 +33,14 @@ export interface Indices_Clone_Request extends Global.Params { export type Indices_Clone_RequestBody = { aliases?: Record; - settings?: Record>; + settings?: Record; } export interface Indices_Clone_Response extends ApiResponse { body: Indices_Clone_ResponseBody; } -export type Indices_Clone_ResponseBody = { - acknowledged: boolean; +export interface Indices_Clone_ResponseBody extends Common.AcknowledgedResponseBase { index: Common.IndexName; shards_acknowledged: boolean; } diff --git a/api/indices/close.d.ts b/api/indices/close.d.ts index 816ef3621..702baf158 100644 --- a/api/indices/close.d.ts +++ b/api/indices/close.d.ts @@ -34,8 +34,7 @@ export interface Indices_Close_Response extends ApiResponse { body: Indices_Close_ResponseBody; } -export type Indices_Close_ResponseBody = { - acknowledged: boolean; +export interface Indices_Close_ResponseBody extends Common.AcknowledgedResponseBase { indices: Record; shards_acknowledged: boolean; } diff --git a/api/indices/rollover.d.ts b/api/indices/rollover.d.ts index 68df9e5e8..bacd273b9 100644 --- a/api/indices/rollover.d.ts +++ b/api/indices/rollover.d.ts @@ -36,15 +36,14 @@ export type Indices_Rollover_RequestBody = { aliases?: Record; conditions?: Indices_Rollover.RolloverConditions; mappings?: Common_Mapping.TypeMapping; - settings?: Record>; + settings?: Record; } export interface Indices_Rollover_Response extends ApiResponse { body: Indices_Rollover_ResponseBody; } -export type Indices_Rollover_ResponseBody = { - acknowledged: boolean; +export interface Indices_Rollover_ResponseBody extends Common.AcknowledgedResponseBase { conditions: Record; dry_run: boolean; new_index: string; diff --git a/api/indices/shardStores.d.ts b/api/indices/shardStores.d.ts index 607853971..1197c28f9 100644 --- a/api/indices/shardStores.d.ts +++ b/api/indices/shardStores.d.ts @@ -24,7 +24,7 @@ export interface Indices_ShardStores_Request extends Global.Params { expand_wildcards?: Common.ExpandWildcards; ignore_unavailable?: boolean; index?: Common.Indices; - status?: Indices_ShardStores.Status | Indices_ShardStores.Status[]; + status?: Indices_ShardStores.ShardStoreStatus | Indices_ShardStores.ShardStoreStatus[]; } export interface Indices_ShardStores_Response extends ApiResponse { diff --git a/api/indices/shrink.d.ts b/api/indices/shrink.d.ts index 2639f25e8..f0724a6be 100644 --- a/api/indices/shrink.d.ts +++ b/api/indices/shrink.d.ts @@ -34,15 +34,14 @@ export interface Indices_Shrink_Request extends Global.Params { export type Indices_Shrink_RequestBody = { aliases?: Record; - settings?: Record>; + settings?: Record; } export interface Indices_Shrink_Response extends ApiResponse { body: Indices_Shrink_ResponseBody; } -export type Indices_Shrink_ResponseBody = { - acknowledged: boolean; +export interface Indices_Shrink_ResponseBody extends Common.AcknowledgedResponseBase { index: Common.IndexName; shards_acknowledged: boolean; } diff --git a/api/indices/split.d.ts b/api/indices/split.d.ts index 5adf43d4a..3aa723828 100644 --- a/api/indices/split.d.ts +++ b/api/indices/split.d.ts @@ -42,8 +42,7 @@ export interface Indices_Split_Response extends ApiResponse { body: Indices_Split_ResponseBody; } -export type Indices_Split_ResponseBody = { - acknowledged: boolean; +export interface Indices_Split_ResponseBody extends Common.AcknowledgedResponseBase { index: Common.IndexName; shards_acknowledged: boolean; } diff --git a/api/indices/upgrade.d.ts b/api/indices/upgrade.d.ts index 711032c61..f2f8353ab 100644 --- a/api/indices/upgrade.d.ts +++ b/api/indices/upgrade.d.ts @@ -21,7 +21,6 @@ import * as Indices_Common from '../_types/indices._common' export interface Indices_Upgrade_Request extends Global.Params { allow_no_indices?: boolean; - body?: Indices_Common.UpgradeRequest; expand_wildcards?: Common.ExpandWildcards; ignore_unavailable?: boolean; index?: string[]; @@ -33,5 +32,7 @@ export interface Indices_Upgrade_Response extends ApiResponse { body: Indices_Upgrade_ResponseBody; } -export type Indices_Upgrade_ResponseBody = Indices_Common.IndexPostUpgradeStatus +export interface Indices_Upgrade_ResponseBody extends Common.ShardsOperationResponseBase { + upgraded_indices?: Record; +} diff --git a/api/indices/upgrade.js b/api/indices/upgrade.js index 59aec09d1..43b18cb47 100644 --- a/api/indices/upgrade.js +++ b/api/indices/upgrade.js @@ -31,7 +31,6 @@ const { normalizeArguments, parsePathParam } = require('../utils'); * @param {boolean} [params.only_ancient_segments] - If `true`, only ancient (an older Lucene major release) segments will be upgraded. * @param {boolean} [params.wait_for_completion=false] - Should this request wait until the operation has completed before returning. * @param {array} [params.index] - Comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. - * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response