From dfeef186796c4df3911ef272012fed4a9c9562dd Mon Sep 17 00:00:00 2001 From: nhtruong <644650+nhtruong@users.noreply.github.com> Date: Wed, 22 Jan 2025 00:45:29 +0000 Subject: [PATCH] Updated opensearch-js to reflect the latest OpenSearch API spec (2025-01-22) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/_types/_common.aggregations.d.ts | 193 +++++---------------------- api/_types/_common.d.ts | 3 +- api/cat/aliases.js | 2 +- api/cat/indices.js | 2 +- api/cat/segmentReplication.js | 2 +- 5 files changed, 41 insertions(+), 161 deletions(-) diff --git a/api/_types/_common.aggregations.d.ts b/api/_types/_common.aggregations.d.ts index 1b3e05a37..63b6f9645 100644 --- a/api/_types/_common.aggregations.d.ts +++ b/api/_types/_common.aggregations.d.ts @@ -28,7 +28,7 @@ export type AdjacencyMatrixBucket = MultiBucketBase & { key: string; } -export type Aggregate = CardinalityAggregate | HdrPercentilesAggregate | HdrPercentileRanksAggregate | TDigestPercentilesAggregate | TDigestPercentileRanksAggregate | PercentilesBucketAggregate | MedianAbsoluteDeviationAggregate | MinAggregate | MaxAggregate | SumAggregate | AvgAggregate | WeightedAvgAggregate | ValueCountAggregate | SimpleValueAggregate | DerivativeAggregate | BucketMetricValueAggregate | StatsAggregate | StatsBucketAggregate | ExtendedStatsAggregate | ExtendedStatsBucketAggregate | GeoBoundsAggregate | GeoCentroidAggregate | HistogramAggregate | DateHistogramAggregate | AutoDateHistogramAggregate | VariableWidthHistogramAggregate | StringTermsAggregate | LongTermsAggregate | DoubleTermsAggregate | UnmappedTermsAggregate | LongRareTermsAggregate | StringRareTermsAggregate | UnmappedRareTermsAggregate | MultiTermsAggregate | MissingAggregate | NestedAggregate | ReverseNestedAggregate | GlobalAggregate | FilterAggregate | ChildrenAggregate | ParentAggregate | SamplerAggregate | UnmappedSamplerAggregate | GeoHashGridAggregate | GeoTileGridAggregate | GeoHexGridAggregate | RangeAggregate | DateRangeAggregate | GeoDistanceAggregate | IpRangeAggregate | IpPrefixAggregate | FiltersAggregate | AdjacencyMatrixAggregate | SignificantLongTermsAggregate | SignificantStringTermsAggregate | UnmappedSignificantTermsAggregate | CompositeAggregate | FrequentItemSetsAggregate | ScriptedMetricAggregate | TopHitsAggregate | InferenceAggregate | StringStatsAggregate | BoxPlotAggregate | TopMetricsAggregate | TTestAggregate | RateAggregate | CumulativeCardinalityAggregate | MatrixStatsAggregate | GeoLineAggregate +export type Aggregate = CardinalityAggregate | HdrPercentilesAggregate | HdrPercentileRanksAggregate | TDigestPercentilesAggregate | TDigestPercentileRanksAggregate | PercentilesBucketAggregate | MedianAbsoluteDeviationAggregate | MinAggregate | MaxAggregate | SumAggregate | AvgAggregate | WeightedAvgAggregate | ValueCountAggregate | SimpleValueAggregate | DerivativeAggregate | BucketMetricValueAggregate | StatsAggregate | StatsBucketAggregate | ExtendedStatsAggregate | ExtendedStatsBucketAggregate | GeoBoundsAggregate | GeoCentroidAggregate | HistogramAggregate | DateHistogramAggregate | AutoDateHistogramAggregate | VariableWidthHistogramAggregate | StringTermsAggregate | LongTermsAggregate | DoubleTermsAggregate | UnmappedTermsAggregate | LongRareTermsAggregate | StringRareTermsAggregate | UnmappedRareTermsAggregate | MultiTermsAggregate | MissingAggregate | NestedAggregate | ReverseNestedAggregate | GlobalAggregate | FilterAggregate | ChildrenAggregate | ParentAggregate | SamplerAggregate | UnmappedSamplerAggregate | GeoHashGridAggregate | GeoTileGridAggregate | RangeAggregate | DateRangeAggregate | GeoDistanceAggregate | IpRangeAggregate | FiltersAggregate | AdjacencyMatrixAggregate | SignificantLongTermsAggregate | SignificantStringTermsAggregate | UnmappedSignificantTermsAggregate | CompositeAggregate | ScriptedMetricAggregate | TopHitsAggregate | InferenceAggregate | StringStatsAggregate | BoxPlotAggregate | TopMetricsAggregate | TTestAggregate | RateAggregate | CumulativeCardinalityAggregate | MatrixStatsAggregate | GeoLineAggregate export type AggregateBase = { meta?: Common.Metadata; @@ -48,13 +48,10 @@ export type AggregationContainer = { avg?: AverageAggregation; avg_bucket?: AverageBucketAggregation; boxplot?: BoxplotAggregation; - bucket_correlation?: BucketCorrelationAggregation; - bucket_count_ks_test?: BucketKsAggregation; bucket_script?: BucketScriptAggregation; bucket_selector?: BucketSelectorAggregation; bucket_sort?: BucketSortAggregation; cardinality?: CardinalityAggregation; - categorize_text?: CategorizeTextAggregation; children?: ChildrenAggregation; composite?: CompositeAggregation; cumulative_cardinality?: CumulativeCardinalityAggregation; @@ -67,18 +64,15 @@ export type AggregationContainer = { extended_stats_bucket?: ExtendedStatsBucketAggregation; filter?: Common_QueryDsl.QueryContainer; filters?: FiltersAggregation; - frequent_item_sets?: FrequentItemSetsAggregation; geo_bounds?: GeoBoundsAggregation; geo_centroid?: GeoCentroidAggregation; geo_distance?: GeoDistanceAggregation; geo_line?: GeoLineAggregation; geohash_grid?: GeoHashGridAggregation; - geohex_grid?: GeohexGridAggregation; geotile_grid?: GeoTileGridAggregation; global?: GlobalAggregation; histogram?: HistogramAggregation; inference?: InferenceAggregation; - ip_prefix?: IpPrefixAggregation; ip_range?: IpRangeAggregation; line?: GeoLineAggregation; matrix_stats?: MatrixStatsAggregation; @@ -145,7 +139,7 @@ export type AutoDateHistogramAggregation = BucketAggregationBase & { minimum_interval?: MinimumInterval; missing?: Common.DateTime; offset?: string; - params?: Record>; + params?: Record; script?: Common.Script; time_zone?: Common.TimeZone; } @@ -179,30 +173,6 @@ export type BoxplotAggregation = MetricAggregationBase & { export type BucketAggregationBase = Aggregation & Record -export type BucketCorrelationAggregation = BucketPathAggregation & { - function: BucketCorrelationFunction; -} - -export type BucketCorrelationFunction = { - count_correlation: BucketCorrelationFunctionCountCorrelation; -} - -export type BucketCorrelationFunctionCountCorrelation = { - indicator: BucketCorrelationFunctionCountCorrelationIndicator; -} - -export type BucketCorrelationFunctionCountCorrelationIndicator = { - doc_count: number; - expectations: number[]; - fractions?: number[]; -} - -export type BucketKsAggregation = BucketPathAggregation & { - alternative?: string[]; - fractions?: number[]; - sampling_method?: string; -} - export type BucketMetricValueAggregate = SingleMetricAggregateBase & { keys: string[]; } @@ -229,18 +199,12 @@ export type BucketSelectorAggregation = PipelineAggregationBase & { export type BucketsFiltersBucket = Record | FiltersBucket[] -export type BucketsFrequentItemSetsBucket = Record | FrequentItemSetsBucket[] - export type BucketsGeoHashGridBucket = Record | GeoHashGridBucket[] -export type BucketsGeoHexGridBucket = Record | GeoHexGridBucket[] - export type BucketsGeoTileGridBucket = Record | GeoTileGridBucket[] export type BucketsHistogramBucket = Record | HistogramBucket[] -export type BucketsIpPrefixBucket = Record | IpPrefixBucket[] - export type BucketsIpRangeBucket = Record | IpRangeBucket[] export type BucketsLongRareTermsBucket = Record | LongRareTermsBucket[] @@ -274,7 +238,7 @@ export type BucketsVariableWidthHistogramBucket = Record | Common.Void[] -export type CalendarInterval = 'day' | 'hour' | 'minute' | 'month' | 'quarter' | 'second' | 'week' | 'year' +export type CalendarInterval = 'second' | '1s' | 'minute' | '1m' | 'hour' | '1h' | 'day' | '1d' | 'week' | '1w' | 'month' | '1M' | 'quarter' | '1q' | 'year' | '1Y' export type CardinalityAggregate = AggregateBase & { value: number; @@ -288,21 +252,6 @@ export type CardinalityAggregation = MetricAggregationBase & { export type CardinalityExecutionMode = 'direct' | 'global_ordinals' | 'save_memory_heuristic' | 'save_time_heuristic' | 'segment_ordinals' -export type CategorizeTextAggregation = Aggregation & { - categorization_analyzer?: CategorizeTextAnalyzer; - categorization_filters?: string[]; - field: Common.Field; - max_matched_tokens?: number; - max_unique_tokens?: number; - min_doc_count?: number; - shard_min_doc_count?: number; - shard_size?: number; - similarity_threshold?: number; - size?: number; -} - -export type CategorizeTextAnalyzer = string | CustomCategorizeTextAnalyzer - export type ChildrenAggregate = SingleBucketAggregateBase & Record export type ChildrenAggregation = BucketAggregationBase & { @@ -334,27 +283,18 @@ export type CompositeAggregation = BucketAggregationBase & { sources?: Record[]; } -export type CompositeAggregationBase = { - field?: Common.Field; - missing_bucket?: boolean; - missing_order?: MissingOrder; - order?: Common.SortOrder; - script?: Common.Script; - value_type?: ValueType; -} - export type CompositeAggregationSource = { - date_histogram?: CompositeDateHistogramAggregation; - geotile_grid?: CompositeGeoTileGridAggregation; - histogram?: CompositeHistogramAggregation; - terms?: CompositeTermsAggregation; + date_histogram?: CompositeDateHistogramAggregationSource; + geotile_grid?: CompositeGeoTileGridAggregationSource; + histogram?: CompositeHistogramAggregationSource; + terms?: CompositeTermsAggregationSource; } export type CompositeBucket = MultiBucketBase & { key: CompositeAggregateKey; } -export type CompositeDateHistogramAggregation = CompositeAggregationBase & { +export type CompositeDateHistogramAggregationSource = CompositeValuesSource & { calendar_interval?: Common.DurationLarge; fixed_interval?: Common.DurationLarge; format?: string; @@ -362,16 +302,25 @@ export type CompositeDateHistogramAggregation = CompositeAggregationBase & { time_zone?: Common.TimeZone; } -export type CompositeGeoTileGridAggregation = CompositeAggregationBase & { +export type CompositeGeoTileGridAggregationSource = CompositeValuesSource & { bounds?: Common.GeoBounds; precision?: number; } -export type CompositeHistogramAggregation = CompositeAggregationBase & { +export type CompositeHistogramAggregationSource = CompositeValuesSource & { interval: number; } -export type CompositeTermsAggregation = CompositeAggregationBase & Record +export type CompositeTermsAggregationSource = CompositeValuesSource & Record + +export type CompositeValuesSource = { + field?: Common.Field; + missing_bucket?: boolean; + missing_order?: MissingOrder; + order?: Common.SortOrder; + script?: Common.Script; + value_type?: ValueType; +} export type CumulativeCardinalityAggregate = AggregateBase & { value: number; @@ -382,12 +331,6 @@ export type CumulativeCardinalityAggregation = PipelineAggregationBase & Record< export type CumulativeSumAggregation = PipelineAggregationBase & Record -export type CustomCategorizeTextAnalyzer = { - char_filter?: string[]; - filter?: string[]; - tokenizer?: string; -} - export type DateHistogramAggregate = MultiBucketAggregateBaseDateHistogramBucket & Record export type DateHistogramAggregation = BucketAggregationBase & { @@ -402,8 +345,8 @@ export type DateHistogramAggregation = BucketAggregationBase & { min_doc_count?: number; missing?: Common.DateTime; offset?: Common.Duration; - order?: AggregateOrder; - params?: Record>; + order?: HistogramOrder; + params?: Record; script?: Common.Script; time_zone?: Common.TimeZone; } @@ -419,7 +362,7 @@ export type DateRangeAggregation = BucketAggregationBase & { field?: Common.Field; format?: string; keyed?: boolean; - missing?: Missing; + missing?: Common.FieldValue; ranges?: DateRangeExpression[]; time_zone?: Common.TimeZone; } @@ -521,27 +464,6 @@ export type FormattableMetricAggregation = MetricAggregationBase & { format?: string; } -export type FrequentItemSetsAggregate = MultiBucketAggregateBaseFrequentItemSetsBucket & Record - -export type FrequentItemSetsAggregation = { - fields: FrequentItemSetsField[]; - filter?: Common_QueryDsl.QueryContainer; - minimum_set_size?: number; - minimum_support?: number; - size?: number; -} - -export type FrequentItemSetsBucket = MultiBucketBase & { - key: Record; - support: number; -} - -export type FrequentItemSetsField = { - exclude?: TermsExclude; - field: Common.Field; - include?: TermsInclude; -} - export type GapPolicy = 'insert_zeros' | 'keep_values' | 'skip' export type GeoBoundsAggregate = AggregateBase & { @@ -586,20 +508,6 @@ export type GeoHashGridBucket = MultiBucketBase & { key: Common.GeoHash; } -export type GeoHexGridAggregate = MultiBucketAggregateBaseGeoHexGridBucket & Record - -export type GeohexGridAggregation = BucketAggregationBase & { - bounds?: Common.GeoBounds; - field: Common.Field; - precision?: number; - shard_size?: number; - size?: number; -} - -export type GeoHexGridBucket = MultiBucketBase & { - key: Common.GeoHexCell; -} - export type GeoLineAggregate = AggregateBase & { geometry: Common.GeoLine; properties: Record; @@ -664,7 +572,7 @@ export type HistogramAggregation = BucketAggregationBase & { min_doc_count?: number; missing?: number; offset?: number; - order?: AggregateOrder; + order?: HistogramOrder; script?: Common.Script; } @@ -673,6 +581,11 @@ export type HistogramBucket = MultiBucketBase & { key_as_string?: string; } +export type HistogramOrder = { + _count?: Common.SortOrder; + _key?: Common.SortOrder; +} + export type HoltLinearModelSettings = { alpha?: number; beta?: number; @@ -733,24 +646,6 @@ export type InferenceTopClassEntry = { class_score: number; } -export type IpPrefixAggregate = MultiBucketAggregateBaseIpPrefixBucket & Record - -export type IpPrefixAggregation = BucketAggregationBase & { - append_prefix_length?: boolean; - field: Common.Field; - is_ipv6?: boolean; - keyed?: boolean; - min_doc_count?: number; - prefix_length: number; -} - -export type IpPrefixBucket = MultiBucketBase & { - is_ipv6: boolean; - key: string; - netmask?: string; - prefix_length: number; -} - export type IpRangeAggregate = MultiBucketAggregateBaseIpRangeBucket & Record export type IpRangeAggregation = BucketAggregationBase & { @@ -830,7 +725,7 @@ export type MedianAbsoluteDeviationAggregation = FormatMetricAggregationBase & { export type MetricAggregationBase = { field?: Common.Field; - missing?: Missing; + missing?: Common.FieldValue; script?: Common.Script; } @@ -842,13 +737,11 @@ export type MinBucketAggregation = PipelineAggregationBase & Record export type MinimumInterval = 'day' | 'hour' | 'minute' | 'month' | 'second' | 'year' -export type Missing = string | number | number | boolean - export type MissingAggregate = SingleBucketAggregateBase & Record export type MissingAggregation = BucketAggregationBase & { field?: Common.Field; - missing?: Missing; + missing?: Common.FieldValue; } export type MissingOrder = 'default' | 'first' | 'last' @@ -893,18 +786,10 @@ export type MultiBucketAggregateBaseFiltersBucket = AggregateBase & { buckets: BucketsFiltersBucket; } -export type MultiBucketAggregateBaseFrequentItemSetsBucket = AggregateBase & { - buckets: BucketsFrequentItemSetsBucket; -} - export type MultiBucketAggregateBaseGeoHashGridBucket = AggregateBase & { buckets: BucketsGeoHashGridBucket; } -export type MultiBucketAggregateBaseGeoHexGridBucket = AggregateBase & { - buckets: BucketsGeoHexGridBucket; -} - export type MultiBucketAggregateBaseGeoTileGridBucket = AggregateBase & { buckets: BucketsGeoTileGridBucket; } @@ -913,10 +798,6 @@ export type MultiBucketAggregateBaseHistogramBucket = AggregateBase & { buckets: BucketsHistogramBucket; } -export type MultiBucketAggregateBaseIpPrefixBucket = AggregateBase & { - buckets: BucketsIpPrefixBucket; -} - export type MultiBucketAggregateBaseIpRangeBucket = AggregateBase & { buckets: BucketsIpRangeBucket; } @@ -967,7 +848,7 @@ export type MultiBucketBase = { export type MultiTermLookup = { field: Common.Field; - missing?: Missing; + missing?: Common.FieldValue; } export type MultiTermsAggregate = TermsAggregateBaseMultiTermsBucket & Record @@ -975,7 +856,7 @@ export type MultiTermsAggregate = TermsAggregateBaseMultiTermsBucket & Record>; + params?: Record; reduce_script?: Common.Script; } @@ -1325,7 +1206,7 @@ export type TermsAggregation = BucketAggregationBase & { format?: string; include?: TermsInclude; min_doc_count?: number; - missing?: Missing; + missing?: Common.FieldValue; missing_bucket?: boolean; missing_order?: MissingOrder; order?: AggregateOrder; diff --git a/api/_types/_common.d.ts b/api/_types/_common.d.ts index e5d3fd827..42822e0c4 100644 --- a/api/_types/_common.d.ts +++ b/api/_types/_common.d.ts @@ -236,6 +236,7 @@ export type GeoDistanceSort = { mode?: SortMode; order?: SortOrder; unit?: DistanceUnit; + [key: string]: any | GeoLocation[]; } export type GeoDistanceType = 'arc' | 'plane' @@ -248,8 +249,6 @@ export type GeoHashLocation = { export type GeoHashPrecision = number | string -export type GeoHexCell = string - export type GeoLine = { coordinates: number[][]; type: string; diff --git a/api/cat/aliases.js b/api/cat/aliases.js index bc97b7452..38ac11757 100644 --- a/api/cat/aliases.js +++ b/api/cat/aliases.js @@ -25,7 +25,7 @@ const { normalizeArguments, parsePathParam } = require('../utils'); * @memberOf API-Cat * * @param {object} [params] - * @param {string} [params.expand_wildcards] - Expands wildcard expressions to concrete indexes. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. + * @param {string} [params.expand_wildcards] - Specifies the type of index that wildcard expressions can match. Supports comma-separated values. * @param {string} [params.format] - A short version of the `Accept` header, such as `json` or `yaml`. * @param {array} [params.h] - A comma-separated list of column names to display. * @param {boolean} [params.help=false] - Returns help information. diff --git a/api/cat/indices.js b/api/cat/indices.js index b721cecd0..122b20b6f 100644 --- a/api/cat/indices.js +++ b/api/cat/indices.js @@ -27,7 +27,7 @@ const { normalizeArguments, parsePathParam } = require('../utils'); * @param {object} [params] * @param {string} [params.bytes] - The units used to display byte values. * @param {string} [params.cluster_manager_timeout] - The amount of time allowed to establish a connection to the cluster manager node. - * @param {string} [params.expand_wildcards] - The type of index that wildcard patterns can match. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. + * @param {string} [params.expand_wildcards] - Specifies the type of index that wildcard expressions can match. Supports comma-separated values. * @param {string} [params.format] - A short version of the `Accept` header, such as `json` or `yaml`. * @param {array} [params.h] - A comma-separated list of column names to display. * @param {string} [params.health] - Limits indexes based on their health status. Supported values are `green`, `yellow`, and `red`. diff --git a/api/cat/segmentReplication.js b/api/cat/segmentReplication.js index a78f80f93..147709051 100644 --- a/api/cat/segmentReplication.js +++ b/api/cat/segmentReplication.js @@ -31,7 +31,7 @@ These metrics provide information about how far behind the primary shard the rep * @param {string} [params.bytes] - The units used to display byte values. * @param {boolean} [params.completed_only=false] - When `true`, the response only includes the last-completed segment replication events. * @param {boolean} [params.detailed=false] - When `true`, the response includes additional metrics for each stage of a segment replication event. - * @param {string} [params.expand_wildcards] - The type of index that wildcard patterns can match. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. + * @param {string} [params.expand_wildcards] - Specifies the type of index that wildcard expressions can match. Supports comma-separated values. * @param {string} [params.format] - A short version of the `Accept` header, such as `json` or `yaml`. * @param {array} [params.h] - A comma-separated list of column names to display. * @param {boolean} [params.help=false] - Returns help information.