Skip to content

Commit be85743

Browse files
Updated opensearch-js to reflect the latest OpenSearch API spec (2025-04-02) (#1003)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: nhtruong <[email protected]>
1 parent c2b1f0b commit be85743

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+595
-333
lines changed

api/OpenSearchApi.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,14 @@ export default class OpenSearchAPI {
692692

693693
};
694694

695+
ltr: {
696+
stats (params?: API.Ltr_Stats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ltr_Stats_Response>;
697+
stats (callback: callbackFn<API.Ltr_Stats_Response>): TransportRequestCallback;
698+
stats (params: API.Ltr_Stats_Request, callback: callbackFn<API.Ltr_Stats_Response>): TransportRequestCallback;
699+
stats (params: API.Ltr_Stats_Request, options: TransportRequestOptions, callback: callbackFn<API.Ltr_Stats_Response>): TransportRequestCallback;
700+
701+
};
702+
695703
ml: {
696704
executeAlgorithm (params: API.Ml_ExecuteAlgorithm_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_ExecuteAlgorithm_Response>;
697705
executeAlgorithm (params: API.Ml_ExecuteAlgorithm_Request, callback: callbackFn<API.Ml_ExecuteAlgorithm_Response>): TransportRequestCallback;

api/OpenSearchApi.js

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class OpenSearchAPI {
3535
ism: new(require('./ism/_api'))(this),
3636
knn: new(require('./knn/_api'))(this),
3737
list: new(require('./list/_api'))(this),
38+
ltr: new(require('./ltr/_api'))(this),
3839
ml: new(require('./ml/_api'))(this),
3940
nodes: new(require('./nodes/_api'))(this),
4041
notifications: new(require('./notifications/_api'))(this),
@@ -165,6 +166,7 @@ class OpenSearchAPI {
165166
ism: { get() { return this[kApiModules].ism } },
166167
knn: { get() { return this[kApiModules].knn } },
167168
list: { get() { return this[kApiModules].list } },
169+
ltr: { get() { return this[kApiModules].ltr } },
168170
ml: { get() { return this[kApiModules].ml } },
169171
nodes: { get() { return this[kApiModules].nodes } },
170172
notifications: { get() { return this[kApiModules].notifications } },

api/_core/exists.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export interface Exists_Request extends Global.Params {
3434
version_type?: Common.VersionType;
3535
}
3636

37-
export interface Exists_Response extends ApiResponse {
38-
body: Exists_ResponseBody;
39-
}
37+
export type Exists_Response = boolean
4038

4139
export type Exists_ResponseBody = Record<string, any>
4240

api/_core/existsSource.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export interface ExistsSource_Request extends Global.Params {
3333
version_type?: Common.VersionType;
3434
}
3535

36-
export interface ExistsSource_Response extends ApiResponse {
37-
body: ExistsSource_ResponseBody;
38-
}
36+
export type ExistsSource_Response = boolean
3937

4038
export type ExistsSource_ResponseBody = Record<string, any>
4139

api/_core/ping.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import * as Global from '../_types/_global'
1919

2020
export type Ping_Request = Global.Params & Record<string, any>
2121

22-
export interface Ping_Response extends ApiResponse {
23-
body: Ping_ResponseBody;
24-
}
22+
export type Ping_Response = boolean
2523

2624
export type Ping_ResponseBody = Record<string, any>
2725

api/_types/_common.aggregations.d.ts

+143-71
Original file line numberDiff line numberDiff line change
@@ -42,79 +42,150 @@ export type Aggregation = {
4242
}
4343

4444
export type AggregationContainer = {
45-
adjacency_matrix?: AdjacencyMatrixAggregation;
4645
aggregations?: Record<string, AggregationContainer>;
47-
auto_date_histogram?: AutoDateHistogramAggregation;
48-
avg?: AverageAggregation;
49-
avg_bucket?: AverageBucketAggregation;
50-
boxplot?: BoxplotAggregation;
51-
bucket_script?: BucketScriptAggregation;
52-
bucket_selector?: BucketSelectorAggregation;
53-
bucket_sort?: BucketSortAggregation;
54-
cardinality?: CardinalityAggregation;
55-
children?: ChildrenAggregation;
56-
composite?: CompositeAggregation;
57-
cumulative_cardinality?: CumulativeCardinalityAggregation;
58-
cumulative_sum?: CumulativeSumAggregation;
59-
date_histogram?: DateHistogramAggregation;
60-
date_range?: DateRangeAggregation;
61-
derivative?: DerivativeAggregation;
62-
diversified_sampler?: DiversifiedSamplerAggregation;
63-
extended_stats?: ExtendedStatsAggregation;
64-
extended_stats_bucket?: ExtendedStatsBucketAggregation;
65-
filter?: Common_QueryDsl.QueryContainer;
66-
filters?: FiltersAggregation;
67-
geo_bounds?: GeoBoundsAggregation;
68-
geo_centroid?: GeoCentroidAggregation;
69-
geo_distance?: GeoDistanceAggregation;
70-
geo_line?: GeoLineAggregation;
71-
geohash_grid?: GeoHashGridAggregation;
72-
geotile_grid?: GeoTileGridAggregation;
73-
global?: GlobalAggregation;
74-
histogram?: HistogramAggregation;
75-
inference?: InferenceAggregation;
76-
ip_range?: IpRangeAggregation;
77-
line?: GeoLineAggregation;
78-
matrix_stats?: MatrixStatsAggregation;
79-
max?: MaxAggregation;
80-
max_bucket?: MaxBucketAggregation;
81-
median_absolute_deviation?: MedianAbsoluteDeviationAggregation;
46+
aggs?: Record<string, AggregationContainer>;
8247
meta?: Common.Metadata;
83-
min?: MinAggregation;
84-
min_bucket?: MinBucketAggregation;
85-
missing?: MissingAggregation;
86-
moving_avg?: MovingAverageAggregation;
87-
moving_fn?: MovingFunctionAggregation;
88-
moving_percentiles?: MovingPercentilesAggregation;
89-
multi_terms?: MultiTermsAggregation;
90-
nested?: NestedAggregation;
91-
normalize?: NormalizeAggregation;
92-
parent?: ParentAggregation;
93-
percentile_ranks?: PercentileRanksAggregation;
94-
percentiles?: PercentilesAggregation;
95-
percentiles_bucket?: PercentilesBucketAggregation;
96-
range?: RangeAggregation;
97-
rare_terms?: RareTermsAggregation;
98-
rate?: RateAggregation;
99-
reverse_nested?: ReverseNestedAggregation;
100-
sampler?: SamplerAggregation;
101-
scripted_metric?: ScriptedMetricAggregation;
102-
serial_diff?: SerialDifferencingAggregation;
103-
significant_terms?: SignificantTermsAggregation;
104-
significant_text?: SignificantTextAggregation;
105-
stats?: StatsAggregation;
106-
stats_bucket?: StatsBucketAggregation;
107-
string_stats?: StringStatsAggregation;
108-
sum?: SumAggregation;
109-
sum_bucket?: SumBucketAggregation;
110-
t_test?: TTestAggregation;
111-
terms?: TermsAggregation;
112-
top_hits?: TopHitsAggregation;
113-
top_metrics?: TopMetricsAggregation;
114-
value_count?: ValueCountAggregation;
115-
variable_width_histogram?: VariableWidthHistogramAggregation;
116-
weighted_avg?: WeightedAverageAggregation;
117-
}
48+
} & ({
49+
adjacency_matrix: AdjacencyMatrixAggregation;
50+
} | {
51+
auto_date_histogram: AutoDateHistogramAggregation;
52+
} | {
53+
avg: AverageAggregation;
54+
} | {
55+
avg_bucket: AverageBucketAggregation;
56+
} | {
57+
boxplot: BoxplotAggregation;
58+
} | {
59+
bucket_script: BucketScriptAggregation;
60+
} | {
61+
bucket_selector: BucketSelectorAggregation;
62+
} | {
63+
bucket_sort: BucketSortAggregation;
64+
} | {
65+
cardinality: CardinalityAggregation;
66+
} | {
67+
children: ChildrenAggregation;
68+
} | {
69+
composite: CompositeAggregation;
70+
} | {
71+
cumulative_cardinality: CumulativeCardinalityAggregation;
72+
} | {
73+
cumulative_sum: CumulativeSumAggregation;
74+
} | {
75+
date_histogram: DateHistogramAggregation;
76+
} | {
77+
date_range: DateRangeAggregation;
78+
} | {
79+
derivative: DerivativeAggregation;
80+
} | {
81+
diversified_sampler: DiversifiedSamplerAggregation;
82+
} | {
83+
extended_stats: ExtendedStatsAggregation;
84+
} | {
85+
extended_stats_bucket: ExtendedStatsBucketAggregation;
86+
} | {
87+
filter: Common_QueryDsl.QueryContainer;
88+
} | {
89+
filters: FiltersAggregation;
90+
} | {
91+
geo_bounds: GeoBoundsAggregation;
92+
} | {
93+
geo_centroid: GeoCentroidAggregation;
94+
} | {
95+
geo_distance: GeoDistanceAggregation;
96+
} | {
97+
geohash_grid: GeoHashGridAggregation;
98+
} | {
99+
geo_line: GeoLineAggregation;
100+
} | {
101+
geotile_grid: GeoTileGridAggregation;
102+
} | {
103+
global: GlobalAggregation;
104+
} | {
105+
histogram: HistogramAggregation;
106+
} | {
107+
ip_range: IpRangeAggregation;
108+
} | {
109+
inference: InferenceAggregation;
110+
} | {
111+
line: GeoLineAggregation;
112+
} | {
113+
matrix_stats: MatrixStatsAggregation;
114+
} | {
115+
max: MaxAggregation;
116+
} | {
117+
max_bucket: MaxBucketAggregation;
118+
} | {
119+
median_absolute_deviation: MedianAbsoluteDeviationAggregation;
120+
} | {
121+
min: MinAggregation;
122+
} | {
123+
min_bucket: MinBucketAggregation;
124+
} | {
125+
missing: MissingAggregation;
126+
} | {
127+
moving_avg: MovingAverageAggregation;
128+
} | {
129+
moving_percentiles: MovingPercentilesAggregation;
130+
} | {
131+
moving_fn: MovingFunctionAggregation;
132+
} | {
133+
multi_terms: MultiTermsAggregation;
134+
} | {
135+
nested: NestedAggregation;
136+
} | {
137+
normalize: NormalizeAggregation;
138+
} | {
139+
parent: ParentAggregation;
140+
} | {
141+
percentile_ranks: PercentileRanksAggregation;
142+
} | {
143+
percentiles: PercentilesAggregation;
144+
} | {
145+
percentiles_bucket: PercentilesBucketAggregation;
146+
} | {
147+
range: RangeAggregation;
148+
} | {
149+
rare_terms: RareTermsAggregation;
150+
} | {
151+
rate: RateAggregation;
152+
} | {
153+
reverse_nested: ReverseNestedAggregation;
154+
} | {
155+
sampler: SamplerAggregation;
156+
} | {
157+
scripted_metric: ScriptedMetricAggregation;
158+
} | {
159+
serial_diff: SerialDifferencingAggregation;
160+
} | {
161+
significant_terms: SignificantTermsAggregation;
162+
} | {
163+
significant_text: SignificantTextAggregation;
164+
} | {
165+
stats: StatsAggregation;
166+
} | {
167+
stats_bucket: StatsBucketAggregation;
168+
} | {
169+
string_stats: StringStatsAggregation;
170+
} | {
171+
sum: SumAggregation;
172+
} | {
173+
sum_bucket: SumBucketAggregation;
174+
} | {
175+
terms: TermsAggregation;
176+
} | {
177+
top_hits: TopHitsAggregation;
178+
} | {
179+
t_test: TTestAggregation;
180+
} | {
181+
top_metrics: TopMetricsAggregation;
182+
} | {
183+
value_count: ValueCountAggregation;
184+
} | {
185+
weighted_avg: WeightedAverageAggregation;
186+
} | {
187+
variable_width_histogram: VariableWidthHistogramAggregation;
188+
})
118189

119190
export type AggregationRange = {
120191
from?: undefined | number | string;
@@ -1088,6 +1159,7 @@ export type SimpleValueAggregate = SingleMetricAggregateBase & Record<string, an
10881159

10891160
export type SingleBucketAggregateBase = AggregateBase & {
10901161
doc_count: number;
1162+
[key: string]: any | Aggregate;
10911163
}
10921164

10931165
export type SingleMetricAggregateBase = AggregateBase & {

api/_types/_common.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ export type PluginStats = {
471471
licensed?: boolean;
472472
name: Name;
473473
opensearch_version: VersionString;
474+
optional_extended_plugins?: string[];
474475
version: VersionString;
475476
}
476477

@@ -894,7 +895,7 @@ export type WaitForActiveShardOptions = 'all' | 'index-setting'
894895

895896
export type WaitForActiveShards = number | WaitForActiveShardOptions
896897

897-
export type WaitForEvents = 'high' | 'immediate' | 'languid' | 'low' | 'normal' | 'urgent'
898+
export type WaitForEvents = 'immediate' | 'urgent' | 'high' | 'normal' | 'low' | 'languid'
898899

899900
export type WarmerStats = {
900901
current: number;

api/_types/_common.mapping.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ export type VersionProperty = DocValuesPropertyBase & {
452452
}
453453

454454
export type WildcardProperty = DocValuesPropertyBase & {
455+
normalizer?: string;
455456
null_value?: string;
456457
type: 'wildcard';
457458
}

api/_types/_common.query_dsl.d.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ export type DisMaxQuery = QueryBase & {
9292
tie_breaker?: number;
9393
}
9494

95-
export type DistanceFeatureQuery = QueryBase & Record<string, any>
95+
export type DistanceFeatureQuery = QueryBase & ({
96+
field: Common.Field;
97+
origin: Common.GeoLocation;
98+
pivot: Common.Distance;
99+
} | {
100+
field: Common.Field;
101+
origin: Common.DateMath;
102+
pivot: Common.Duration;
103+
})
96104

97105
export type ExistsQuery = QueryBase & {
98106
field: Common.Field;
@@ -224,6 +232,7 @@ export type HasParentQuery = QueryBase & {
224232
}
225233

226234
export type HybridQuery = QueryBase & {
235+
pagination_depth?: number;
227236
queries?: QueryContainer[];
228237
}
229238

@@ -590,7 +599,7 @@ export type RandomScoreFunction = {
590599
seed?: number | string;
591600
}
592601

593-
export type RangeQuery = RangeQueryBase & Record<string, any>
602+
export type RangeQuery = RangeQueryBase & (NumberRangeQueryParameters | DateRangeQueryParameters)
594603

595604
export type RangeQueryBase = QueryBase & {
596605
relation?: RangeRelation;

api/_types/_core.explain.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
export type Explanation = {
1919
description: string;
2020
details: ExplanationDetail[];
21-
value: number | number | number | number;
21+
value: number;
2222
}
2323

2424
export type ExplanationDetail = {
2525
description: string;
2626
details?: ExplanationDetail[];
27-
value: number | number | number | number;
27+
value: number;
2828
}
2929

api/_types/cluster.stats.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export type ClusterNodeCount = {
117117
total: number;
118118
transform?: number;
119119
voting_only?: number;
120+
warm?: number;
120121
}
121122

122123
export type ClusterNodes = {

0 commit comments

Comments
 (0)