Skip to content

Commit e00d0ec

Browse files
nhtruonggithub-actions[bot]
authored andcommitted
Updated opensearch-js to reflect the latest OpenSearch API spec (2024-10-31)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 5f55f06 commit e00d0ec

File tree

454 files changed

+2966
-2275
lines changed

Some content is hidden

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

454 files changed

+2966
-2275
lines changed

api/OpenSearchApi.d.ts

+31
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,13 @@ export default class OpenSearchAPI {
580580

581581
};
582582

583+
insights: {
584+
topQueries (params: API.Insights_TopQueries_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Insights_TopQueries_Response>;
585+
topQueries (params: API.Insights_TopQueries_Request, callback: callbackFn<API.Insights_TopQueries_Response>): TransportRequestCallback;
586+
topQueries (params: API.Insights_TopQueries_Request, options: TransportRequestOptions, callback: callbackFn<API.Insights_TopQueries_Response>): TransportRequestCallback;
587+
588+
};
589+
583590
ism: {
584591
addPolicy (params?: API.Ism_AddPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_AddPolicy_Response>;
585592
addPolicy (callback: callbackFn<API.Ism_AddPolicy_Response>): TransportRequestCallback;
@@ -1400,6 +1407,26 @@ export default class OpenSearchAPI {
14001407

14011408
};
14021409

1410+
wlm: {
1411+
getQueryGroup (params?: API.Wlm_GetQueryGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Wlm_GetQueryGroup_Response>;
1412+
getQueryGroup (callback: callbackFn<API.Wlm_GetQueryGroup_Response>): TransportRequestCallback;
1413+
getQueryGroup (params: API.Wlm_GetQueryGroup_Request, callback: callbackFn<API.Wlm_GetQueryGroup_Response>): TransportRequestCallback;
1414+
getQueryGroup (params: API.Wlm_GetQueryGroup_Request, options: TransportRequestOptions, callback: callbackFn<API.Wlm_GetQueryGroup_Response>): TransportRequestCallback;
1415+
1416+
createQueryGroup (params: API.Wlm_CreateQueryGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Wlm_CreateQueryGroup_Response>;
1417+
createQueryGroup (params: API.Wlm_CreateQueryGroup_Request, callback: callbackFn<API.Wlm_CreateQueryGroup_Response>): TransportRequestCallback;
1418+
createQueryGroup (params: API.Wlm_CreateQueryGroup_Request, options: TransportRequestOptions, callback: callbackFn<API.Wlm_CreateQueryGroup_Response>): TransportRequestCallback;
1419+
1420+
deleteQueryGroup (params: API.Wlm_DeleteQueryGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Wlm_DeleteQueryGroup_Response>;
1421+
deleteQueryGroup (params: API.Wlm_DeleteQueryGroup_Request, callback: callbackFn<API.Wlm_DeleteQueryGroup_Response>): TransportRequestCallback;
1422+
deleteQueryGroup (params: API.Wlm_DeleteQueryGroup_Request, options: TransportRequestOptions, callback: callbackFn<API.Wlm_DeleteQueryGroup_Response>): TransportRequestCallback;
1423+
1424+
updateQueryGroup (params: API.Wlm_UpdateQueryGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Wlm_UpdateQueryGroup_Response>;
1425+
updateQueryGroup (params: API.Wlm_UpdateQueryGroup_Request, callback: callbackFn<API.Wlm_UpdateQueryGroup_Response>): TransportRequestCallback;
1426+
updateQueryGroup (params: API.Wlm_UpdateQueryGroup_Request, options: TransportRequestOptions, callback: callbackFn<API.Wlm_UpdateQueryGroup_Response>): TransportRequestCallback;
1427+
1428+
};
1429+
14031430

14041431
http: {
14051432
connect (params: HttpRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse>;
@@ -1454,6 +1481,10 @@ export default class OpenSearchAPI {
14541481
bulk (params: API.Bulk_Request, callback: callbackFn<API.Bulk_Response>): TransportRequestCallback;
14551482
bulk (params: API.Bulk_Request, options: TransportRequestOptions, callback: callbackFn<API.Bulk_Response>): TransportRequestCallback;
14561483

1484+
bulkStream (params: API.BulkStream_Request, options?: TransportRequestOptions): TransportRequestPromise<API.BulkStream_Response>;
1485+
bulkStream (params: API.BulkStream_Request, callback: callbackFn<API.BulkStream_Response>): TransportRequestCallback;
1486+
bulkStream (params: API.BulkStream_Request, options: TransportRequestOptions, callback: callbackFn<API.BulkStream_Response>): TransportRequestCallback;
1487+
14571488
count (params?: API.Count_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Count_Response>;
14581489
count (callback: callbackFn<API.Count_Response>): TransportRequestCallback;
14591490
count (params: API.Count_Request, callback: callbackFn<API.Count_Response>): TransportRequestCallback;

api/OpenSearchApi.js

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class OpenSearchAPI {
3131
http: new(require('./http/_api'))(this),
3232
indices: new(require('./indices/_api'))(this),
3333
ingest: new(require('./ingest/_api'))(this),
34+
insights: new(require('./insights/_api'))(this),
3435
ism: new(require('./ism/_api'))(this),
3536
knn: new(require('./knn/_api'))(this),
3637
ml: new(require('./ml/_api'))(this),
@@ -47,11 +48,13 @@ class OpenSearchAPI {
4748
sql: new(require('./sql/_api'))(this),
4849
tasks: new(require('./tasks/_api'))(this),
4950
transforms: new(require('./transforms/_api'))(this),
51+
wlm: new(require('./wlm/_api'))(this),
5052
}
5153

5254
// Setup Root API Functions
5355
/** @namespace API-Core */
5456
this.bulk = require('./_core/bulk').bind(this)
57+
this.bulkStream = require('./_core/bulkStream').bind(this)
5558
this.clearScroll = require('./_core/clearScroll').bind(this)
5659
this.count = require('./_core/count').bind(this)
5760
this.create = require('./_core/create').bind(this)
@@ -94,6 +97,8 @@ class OpenSearchAPI {
9497
this.updateByQuery = require('./_core/updateByQuery').bind(this)
9598
this.updateByQueryRethrottle = require('./_core/updateByQueryRethrottle').bind(this)
9699

100+
// Deprecated: Use bulkStream instead.
101+
this.bulk_stream = require('./_core/bulkStream').bind(this)
97102
// Deprecated: Use clearScroll instead.
98103
this.clear_scroll = require('./_core/clearScroll').bind(this)
99104
// Deprecated: Use createPit instead.
@@ -153,6 +158,7 @@ class OpenSearchAPI {
153158
http: { get() { return this[kApiModules].http } },
154159
indices: { get() { return this[kApiModules].indices } },
155160
ingest: { get() { return this[kApiModules].ingest } },
161+
insights: { get() { return this[kApiModules].insights } },
156162
ism: { get() { return this[kApiModules].ism } },
157163
knn: { get() { return this[kApiModules].knn } },
158164
ml: { get() { return this[kApiModules].ml } },
@@ -169,6 +175,7 @@ class OpenSearchAPI {
169175
sql: { get() { return this[kApiModules].sql } },
170176
tasks: { get() { return this[kApiModules].tasks } },
171177
transforms: { get() { return this[kApiModules].transforms } },
178+
wlm: { get() { return this[kApiModules].wlm } },
172179

173180
// Deprecated: Use asynchronousSearch instead.
174181
asynchronous_search: { get() { return this[kApiModules].asynchronousSearch } },

api/_core/bulk.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as Core_Bulk from '../_types/_core.bulk'
2020
import * as Core_Search from '../_types/_core.search'
2121
import * as Global from '../_types/_global'
2222

23-
export interface Bulk_Request extends Global.Params {
23+
export type Bulk_Request = Global.Params & {
2424
_source?: Core_Search.SourceConfigParam;
2525
_source_excludes?: Common.Fields;
2626
_source_includes?: Common.Fields;
@@ -29,19 +29,19 @@ export interface Bulk_Request extends Global.Params {
2929
pipeline?: string;
3030
refresh?: Common.Refresh;
3131
require_alias?: boolean;
32-
routing?: Common.Routing;
32+
routing?: Common.RoutingInQueryString;
3333
timeout?: Common.Duration;
3434
type?: string;
3535
wait_for_active_shards?: Common.WaitForActiveShards;
3636
}
3737

3838
export type Bulk_RequestBody = Core_Bulk.OperationContainer | Core_Bulk.UpdateAction | Record<string, any>[]
3939

40-
export interface Bulk_Response extends ApiResponse {
40+
export type Bulk_Response = ApiResponse & {
4141
body: Bulk_ResponseBody;
4242
}
4343

44-
export interface Bulk_ResponseBody {
44+
export type Bulk_ResponseBody = {
4545
errors: boolean;
4646
ingest_took?: number;
4747
items: Record<string, Core_Bulk.ResponseItem>[];

api/_core/bulkStream.d.ts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* The OpenSearch Contributors require contributions made to
6+
* this file be licensed under the Apache-2.0 license or a
7+
* compatible open source license.
8+
*
9+
*/
10+
11+
/*
12+
* This file was generated from the OpenSearch API Spec. Do NOT edit it
13+
* manually. If you want to make changes, either update the spec or
14+
* modify the API generator.
15+
*/
16+
17+
import { ApiResponse } from '../../lib/Transport'
18+
import * as Common from '../_types/_common'
19+
import * as Core_Bulk from '../_types/_core.bulk'
20+
import * as Core_Search from '../_types/_core.search'
21+
import * as Global from '../_types/_global'
22+
23+
export type BulkStream_Request = Global.Params & {
24+
_source?: Core_Search.SourceConfigParam;
25+
_source_excludes?: Common.Fields;
26+
_source_includes?: Common.Fields;
27+
batch_interval?: Common.Duration;
28+
batch_size?: Common.BatchSize;
29+
body: BulkStream_RequestBody;
30+
index?: Common.IndexName;
31+
pipeline?: string;
32+
refresh?: Common.Refresh;
33+
require_alias?: boolean;
34+
routing?: Common.RoutingInQueryString;
35+
timeout?: Common.Duration;
36+
type?: string;
37+
wait_for_active_shards?: Common.WaitForActiveShards;
38+
}
39+
40+
export type BulkStream_RequestBody = Core_Bulk.OperationContainer | Core_Bulk.UpdateAction | Record<string, any>[]
41+
42+
export type BulkStream_Response = ApiResponse & {
43+
body: BulkStream_ResponseBody;
44+
}
45+
46+
export type BulkStream_ResponseBody = {
47+
errors: boolean;
48+
ingest_took?: number;
49+
items: Record<string, Core_Bulk.ResponseItem>[];
50+
took: number;
51+
}
52+

api/_core/bulkStream.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* The OpenSearch Contributors require contributions made to
6+
* this file be licensed under the Apache-2.0 license or a
7+
* compatible open source license.
8+
*
9+
*/
10+
11+
/*
12+
* This file was generated from the OpenSearch API Spec. Do NOT edit it
13+
* manually. If you want to make changes, either update the spec or
14+
* modify the API generator.
15+
*/
16+
17+
'use strict';
18+
19+
const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils');
20+
21+
/**
22+
* Allows to perform multiple index/update/delete operations using request response streaming.
23+
* <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk-streaming/ - bulk_stream}
24+
*
25+
* @memberOf API-Core
26+
*
27+
* @param {object} params
28+
* @param {string} [params._source] - `true` or `false` to return the `_source` field or not, or a list of fields to return.
29+
* @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude from the response.
30+
* @param {string} [params._source_includes] - A comma-separated list of source fields to include in the response.
31+
* @param {string} [params.batch_interval] - Specifies for how long bulk operations should be accumulated into a batch before sending the batch to data nodes.
32+
* @param {number} [params.batch_size] - Specifies how many bulk operations should be accumulated into a batch before sending the batch to data nodes.
33+
* @param {string} [params.pipeline] - ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.
34+
* @param {string} [params.refresh] - If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`.
35+
* @param {boolean} [params.require_alias=false] - If `true`, the request's actions must target an index alias.
36+
* @param {string} [params.routing] - Custom value used to route operations to a specific shard.
37+
* @param {string} [params.timeout] - Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
38+
* @param {string} [params.type] - Default document type for items which don't provide one.
39+
* @param {string} [params.wait_for_active_shards] - The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
40+
* @param {string} [params.index] - Name of the data stream, index, or index alias to perform bulk actions on.
41+
* @param {array} params.body - The operation definition and data (action-data pairs), separated by newlines
42+
*
43+
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}
44+
* @param {function} [callback] - Callback that handles errors and response
45+
*
46+
* @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
47+
*/
48+
function bulkStreamFunc(params, options, callback) {
49+
[params, options, callback] = normalizeArguments(params, options, callback);
50+
if (params.body == null) return handleMissingParam('body', this, callback);
51+
52+
let { body, index, ...querystring } = params;
53+
index = parsePathParam(index);
54+
55+
const path = ['/', index, '/_bulk/stream'].filter(c => c).join('').replace('//', '/');
56+
const method = index == null ? 'POST' : 'PUT';
57+
58+
return this.transport.request({ method, path, querystring, bulkBody: body }, options, callback);
59+
}
60+
61+
module.exports = bulkStreamFunc;

api/_core/clearScroll.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ import { ApiResponse } from '../../lib/Transport'
1818
import * as Common from '../_types/_common'
1919
import * as Global from '../_types/_global'
2020

21-
export interface ClearScroll_Request extends Global.Params {
21+
export type ClearScroll_Request = Global.Params & {
2222
body?: ClearScroll_RequestBody;
2323
scroll_id?: Common.ScrollIds;
2424
}
2525

26-
export interface ClearScroll_RequestBody {
26+
export type ClearScroll_RequestBody = {
2727
scroll_id?: Common.ScrollIds;
2828
}
2929

30-
export interface ClearScroll_Response extends ApiResponse {
30+
export type ClearScroll_Response = ApiResponse & {
3131
body: ClearScroll_ResponseBody;
3232
}
3333

34-
export interface ClearScroll_ResponseBody {
34+
export type ClearScroll_ResponseBody = {
3535
num_freed: number;
3636
succeeded: boolean;
3737
}

api/_core/count.d.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import * as Common from '../_types/_common'
1919
import * as Common_QueryDsl from '../_types/_common.query_dsl'
2020
import * as Global from '../_types/_global'
2121

22-
export interface Count_Request extends Global.Params {
22+
export type Count_Request = Global.Params & {
2323
allow_no_indices?: boolean;
2424
analyze_wildcard?: boolean;
2525
analyzer?: string;
@@ -34,19 +34,19 @@ export interface Count_Request extends Global.Params {
3434
min_score?: number;
3535
preference?: string;
3636
q?: string;
37-
routing?: Common.Routing;
37+
routing?: Common.RoutingInQueryString;
3838
terminate_after?: number;
3939
}
4040

41-
export interface Count_RequestBody {
41+
export type Count_RequestBody = {
4242
query?: Common_QueryDsl.QueryContainer;
4343
}
4444

45-
export interface Count_Response extends ApiResponse {
45+
export type Count_Response = ApiResponse & {
4646
body: Count_ResponseBody;
4747
}
4848

49-
export interface Count_ResponseBody {
49+
export type Count_ResponseBody = {
5050
_shards: Common.ShardStatistics;
5151
count: number;
5252
terminated_early?: boolean;

api/_core/create.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import { ApiResponse } from '../../lib/Transport'
1818
import * as Common from '../_types/_common'
1919
import * as Global from '../_types/_global'
2020

21-
export interface Create_Request extends Global.Params {
21+
export type Create_Request = Global.Params & {
2222
body: Create_RequestBody;
2323
id: Common.Id;
2424
index: Common.IndexName;
2525
pipeline?: string;
2626
refresh?: Common.Refresh;
27-
routing?: Common.Routing;
27+
routing?: Common.RoutingInQueryString;
2828
timeout?: Common.Duration;
2929
version?: Common.VersionNumber;
3030
version_type?: Common.VersionType;
@@ -33,7 +33,7 @@ export interface Create_Request extends Global.Params {
3333

3434
export type Create_RequestBody = Record<string, any>
3535

36-
export interface Create_Response extends ApiResponse {
36+
export type Create_Response = ApiResponse & {
3737
body: Create_ResponseBody;
3838
}
3939

api/_core/createPit.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ import * as Common from '../_types/_common'
1919
import * as Core_Common from '../_types/_core._common'
2020
import * as Global from '../_types/_global'
2121

22-
export interface CreatePit_Request extends Global.Params {
22+
export type CreatePit_Request = Global.Params & {
2323
allow_partial_pit_creation?: boolean;
2424
expand_wildcards?: Common.ExpandWildcards;
2525
index: string[];
2626
keep_alive?: Common.Duration;
2727
preference?: string;
28-
routing?: Common.Routing;
28+
routing?: Common.RoutingInQueryString;
2929
}
3030

31-
export interface CreatePit_Response extends ApiResponse {
31+
export type CreatePit_Response = ApiResponse & {
3232
body: CreatePit_ResponseBody;
3333
}
3434

35-
export interface CreatePit_ResponseBody {
35+
export type CreatePit_ResponseBody = {
3636
_shards?: Core_Common.ShardStatistics;
3737
creation_time?: number;
3838
pit_id?: string;

api/_core/delete.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ import { ApiResponse } from '../../lib/Transport'
1818
import * as Common from '../_types/_common'
1919
import * as Global from '../_types/_global'
2020

21-
export interface Delete_Request extends Global.Params {
21+
export type Delete_Request = Global.Params & {
2222
id: Common.Id;
2323
if_primary_term?: number;
2424
if_seq_no?: Common.SequenceNumber;
2525
index: Common.IndexName;
2626
refresh?: Common.Refresh;
27-
routing?: Common.Routing;
27+
routing?: Common.RoutingInQueryString;
2828
timeout?: Common.Duration;
2929
version?: Common.VersionNumber;
3030
version_type?: Common.VersionType;
3131
wait_for_active_shards?: Common.WaitForActiveShards;
3232
}
3333

34-
export interface Delete_Response extends ApiResponse {
34+
export type Delete_Response = ApiResponse & {
3535
body: Delete_ResponseBody;
3636
}
3737

api/_core/deleteAllPits.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import * as Global from '../_types/_global'
2020

2121
export type DeleteAllPits_Request = Global.Params & Record<string, any>
2222

23-
export interface DeleteAllPits_Response extends ApiResponse {
23+
export type DeleteAllPits_Response = ApiResponse & {
2424
body: DeleteAllPits_ResponseBody;
2525
}
2626

27-
export interface DeleteAllPits_ResponseBody {
27+
export type DeleteAllPits_ResponseBody = {
2828
pits?: Core_Common.PitsDetailsDeleteAll[];
2929
}
3030

0 commit comments

Comments
 (0)