Skip to content

Commit dfd5467

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

File tree

114 files changed

+4701
-401
lines changed

Some content is hidden

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

114 files changed

+4701
-401
lines changed

api/OpenSearchApi.d.ts

+1,627
Large diffs are not rendered by default.

api/OpenSearchApi.js

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
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 { kConfigErr } = require('./utils')
20+
const kApiModules = Symbol('api modules')
21+
22+
class OpenSearchAPI {
23+
constructor (opts) {
24+
this[kConfigErr] = opts.ConfigurationError
25+
this[kApiModules] = {
26+
asynchronousSearch: new(require('./asynchronousSearch/_api'))(this),
27+
cat: new(require('./cat/_api'))(this),
28+
cluster: new(require('./cluster/_api'))(this),
29+
danglingIndices: new(require('./danglingIndices/_api'))(this),
30+
flowFramework: new(require('./flowFramework/_api'))(this),
31+
http: new(require('./http/_api'))(this),
32+
indices: new(require('./indices/_api'))(this),
33+
ingest: new(require('./ingest/_api'))(this),
34+
ism: new(require('./ism/_api'))(this),
35+
knn: new(require('./knn/_api'))(this),
36+
ml: new(require('./ml/_api'))(this),
37+
nodes: new(require('./nodes/_api'))(this),
38+
notifications: new(require('./notifications/_api'))(this),
39+
observability: new(require('./observability/_api'))(this),
40+
ppl: new(require('./ppl/_api'))(this),
41+
query: new(require('./query/_api'))(this),
42+
remoteStore: new(require('./remoteStore/_api'))(this),
43+
rollups: new(require('./rollups/_api'))(this),
44+
searchPipeline: new(require('./searchPipeline/_api'))(this),
45+
security: new(require('./security/_api'))(this),
46+
snapshot: new(require('./snapshot/_api'))(this),
47+
sql: new(require('./sql/_api'))(this),
48+
tasks: new(require('./tasks/_api'))(this),
49+
transforms: new(require('./transforms/_api'))(this),
50+
}
51+
52+
// Setup Root API Functions
53+
/** @namespace API-Core */
54+
this.bulk = require('./_core/bulk').bind(this)
55+
this.clearScroll = require('./_core/clearScroll').bind(this)
56+
this.count = require('./_core/count').bind(this)
57+
this.create = require('./_core/create').bind(this)
58+
this.createPit = require('./_core/createPit').bind(this)
59+
this.delete = require('./_core/delete').bind(this)
60+
this.deleteAllPits = require('./_core/deleteAllPits').bind(this)
61+
this.deleteByQuery = require('./_core/deleteByQuery').bind(this)
62+
this.deleteByQueryRethrottle = require('./_core/deleteByQueryRethrottle').bind(this)
63+
this.deletePit = require('./_core/deletePit').bind(this)
64+
this.deleteScript = require('./_core/deleteScript').bind(this)
65+
this.exists = require('./_core/exists').bind(this)
66+
this.existsSource = require('./_core/existsSource').bind(this)
67+
this.explain = require('./_core/explain').bind(this)
68+
this.fieldCaps = require('./_core/fieldCaps').bind(this)
69+
this.get = require('./_core/get').bind(this)
70+
this.getAllPits = require('./_core/getAllPits').bind(this)
71+
this.getScript = require('./_core/getScript').bind(this)
72+
this.getScriptContext = require('./_core/getScriptContext').bind(this)
73+
this.getScriptLanguages = require('./_core/getScriptLanguages').bind(this)
74+
this.getSource = require('./_core/getSource').bind(this)
75+
this.index = require('./_core/index').bind(this)
76+
this.info = require('./_core/info').bind(this)
77+
this.mget = require('./_core/mget').bind(this)
78+
this.msearch = require('./_core/msearch').bind(this)
79+
this.msearchTemplate = require('./_core/msearchTemplate').bind(this)
80+
this.mtermvectors = require('./_core/mtermvectors').bind(this)
81+
this.ping = require('./_core/ping').bind(this)
82+
this.putScript = require('./_core/putScript').bind(this)
83+
this.rankEval = require('./_core/rankEval').bind(this)
84+
this.reindex = require('./_core/reindex').bind(this)
85+
this.reindexRethrottle = require('./_core/reindexRethrottle').bind(this)
86+
this.renderSearchTemplate = require('./_core/renderSearchTemplate').bind(this)
87+
this.scriptsPainlessExecute = require('./_core/scriptsPainlessExecute').bind(this)
88+
this.scroll = require('./_core/scroll').bind(this)
89+
this.search = require('./_core/search').bind(this)
90+
this.searchShards = require('./_core/searchShards').bind(this)
91+
this.searchTemplate = require('./_core/searchTemplate').bind(this)
92+
this.termvectors = require('./_core/termvectors').bind(this)
93+
this.update = require('./_core/update').bind(this)
94+
this.updateByQuery = require('./_core/updateByQuery').bind(this)
95+
this.updateByQueryRethrottle = require('./_core/updateByQueryRethrottle').bind(this)
96+
97+
// Deprecated: Use clearScroll instead.
98+
this.clear_scroll = require('./_core/clearScroll').bind(this)
99+
// Deprecated: Use createPit instead.
100+
this.create_pit = require('./_core/createPit').bind(this)
101+
// Deprecated: Use deleteAllPits instead.
102+
this.delete_all_pits = require('./_core/deleteAllPits').bind(this)
103+
// Deprecated: Use deleteByQuery instead.
104+
this.delete_by_query = require('./_core/deleteByQuery').bind(this)
105+
// Deprecated: Use deleteByQueryRethrottle instead.
106+
this.delete_by_query_rethrottle = require('./_core/deleteByQueryRethrottle').bind(this)
107+
// Deprecated: Use deletePit instead.
108+
this.delete_pit = require('./_core/deletePit').bind(this)
109+
// Deprecated: Use deleteScript instead.
110+
this.delete_script = require('./_core/deleteScript').bind(this)
111+
// Deprecated: Use existsSource instead.
112+
this.exists_source = require('./_core/existsSource').bind(this)
113+
// Deprecated: Use fieldCaps instead.
114+
this.field_caps = require('./_core/fieldCaps').bind(this)
115+
// Deprecated: Use getAllPits instead.
116+
this.get_all_pits = require('./_core/getAllPits').bind(this)
117+
// Deprecated: Use getScript instead.
118+
this.get_script = require('./_core/getScript').bind(this)
119+
// Deprecated: Use getScriptContext instead.
120+
this.get_script_context = require('./_core/getScriptContext').bind(this)
121+
// Deprecated: Use getScriptLanguages instead.
122+
this.get_script_languages = require('./_core/getScriptLanguages').bind(this)
123+
// Deprecated: Use getSource instead.
124+
this.get_source = require('./_core/getSource').bind(this)
125+
// Deprecated: Use msearchTemplate instead.
126+
this.msearch_template = require('./_core/msearchTemplate').bind(this)
127+
// Deprecated: Use putScript instead.
128+
this.put_script = require('./_core/putScript').bind(this)
129+
// Deprecated: Use rankEval instead.
130+
this.rank_eval = require('./_core/rankEval').bind(this)
131+
// Deprecated: Use reindexRethrottle instead.
132+
this.reindex_rethrottle = require('./_core/reindexRethrottle').bind(this)
133+
// Deprecated: Use renderSearchTemplate instead.
134+
this.render_search_template = require('./_core/renderSearchTemplate').bind(this)
135+
// Deprecated: Use scriptsPainlessExecute instead.
136+
this.scripts_painless_execute = require('./_core/scriptsPainlessExecute').bind(this)
137+
// Deprecated: Use searchShards instead.
138+
this.search_shards = require('./_core/searchShards').bind(this)
139+
// Deprecated: Use searchTemplate instead.
140+
this.search_template = require('./_core/searchTemplate').bind(this)
141+
// Deprecated: Use updateByQuery instead.
142+
this.update_by_query = require('./_core/updateByQuery').bind(this)
143+
// Deprecated: Use updateByQueryRethrottle instead.
144+
this.update_by_query_rethrottle = require('./_core/updateByQueryRethrottle').bind(this)
145+
146+
// Setup API Modules
147+
Object.defineProperties(this, {
148+
asynchronousSearch: { get() { return this[kApiModules].asynchronousSearch } },
149+
cat: { get() { return this[kApiModules].cat } },
150+
cluster: { get() { return this[kApiModules].cluster } },
151+
danglingIndices: { get() { return this[kApiModules].danglingIndices } },
152+
flowFramework: { get() { return this[kApiModules].flowFramework } },
153+
http: { get() { return this[kApiModules].http } },
154+
indices: { get() { return this[kApiModules].indices } },
155+
ingest: { get() { return this[kApiModules].ingest } },
156+
ism: { get() { return this[kApiModules].ism } },
157+
knn: { get() { return this[kApiModules].knn } },
158+
ml: { get() { return this[kApiModules].ml } },
159+
nodes: { get() { return this[kApiModules].nodes } },
160+
notifications: { get() { return this[kApiModules].notifications } },
161+
observability: { get() { return this[kApiModules].observability } },
162+
ppl: { get() { return this[kApiModules].ppl } },
163+
query: { get() { return this[kApiModules].query } },
164+
remoteStore: { get() { return this[kApiModules].remoteStore } },
165+
rollups: { get() { return this[kApiModules].rollups } },
166+
searchPipeline: { get() { return this[kApiModules].searchPipeline } },
167+
security: { get() { return this[kApiModules].security } },
168+
snapshot: { get() { return this[kApiModules].snapshot } },
169+
sql: { get() { return this[kApiModules].sql } },
170+
tasks: { get() { return this[kApiModules].tasks } },
171+
transforms: { get() { return this[kApiModules].transforms } },
172+
173+
// Deprecated: Use asynchronousSearch instead.
174+
asynchronous_search: { get() { return this[kApiModules].asynchronousSearch } },
175+
// Deprecated: Use danglingIndices instead.
176+
dangling_indices: { get() { return this[kApiModules].danglingIndices } },
177+
// Deprecated: Use flowFramework instead.
178+
flow_framework: { get() { return this[kApiModules].flowFramework } },
179+
// Deprecated: Use remoteStore instead.
180+
remote_store: { get() { return this[kApiModules].remoteStore } },
181+
// Deprecated: Use searchPipeline instead.
182+
search_pipeline: { get() { return this[kApiModules].searchPipeline } },
183+
})
184+
}
185+
}
186+
187+
module.exports = OpenSearchAPI;

api/_core/createPit.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface CreatePit_Request extends Global.Params {
2525
index: string[];
2626
keep_alive?: Common.Duration;
2727
preference?: string;
28-
routing?: string[];
28+
routing?: Common.Routing;
2929
}
3030

3131
export interface CreatePit_Response extends ApiResponse {

api/_core/createPit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
2929
* @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both.
3030
* @param {string} [params.keep_alive] - Specify the keep alive for point in time.
3131
* @param {string} [params.preference=random] - Specify the node or shard the operation should be performed on.
32-
* @param {array} [params.routing] - Comma-separated list of specific routing values.
32+
* @param {string} [params.routing] - Comma-separated list of specific routing values.
3333
* @param {array} params.index - Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices.
3434
*
3535
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}

api/_core/deleteByQuery.d.ts

+1-16
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,7 @@ export interface DeleteByQuery_Response extends ApiResponse {
6767
body: DeleteByQuery_ResponseBody;
6868
}
6969

70-
export interface DeleteByQuery_ResponseBody {
71-
batches?: number;
72-
deleted?: number;
73-
failures?: Common.BulkIndexByScrollFailure[];
74-
noops?: number;
75-
requests_per_second?: number;
76-
retries?: Common.Retries;
77-
slice_id?: number;
70+
export type DeleteByQuery_ResponseBody = Common.BulkByScrollResponseBase | {
7871
task?: Common.TaskId;
79-
throttled?: Common.Duration;
80-
throttled_millis?: Common.DurationValueUnitMillis;
81-
throttled_until?: Common.Duration;
82-
throttled_until_millis?: Common.DurationValueUnitMillis;
83-
timed_out?: boolean;
84-
took?: Common.DurationValueUnitMillis;
85-
total?: number;
86-
version_conflicts?: number;
8772
}
8873

api/_core/putScript.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
2626
*
2727
* @param {object} params
2828
* @param {string} [params.cluster_manager_timeout] - Operation timeout for connection to cluster-manager node.
29+
* @param {string} [params.context] - Context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context.
2930
* @param {string} [params.master_timeout] DEPRECATED - Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
3031
* @param {string} [params.timeout] - Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
3132
* @param {string} params.id - Identifier for the stored script or search template. Must be unique within the cluster.
32-
* @param {string} [params.context] - Context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context.
3333
* @param {object} params.body - The document
3434
*
3535
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}

api/_core/rankEval.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface RankEval_Request extends Global.Params {
2525
expand_wildcards?: Common.ExpandWildcards;
2626
ignore_unavailable?: boolean;
2727
index?: Common.Indices;
28-
search_type?: string;
28+
search_type?: Common.SearchType;
2929
}
3030

3131
export interface RankEval_RequestBody {

api/_core/reindex.d.ts

+1-16
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,7 @@ export interface Reindex_Response extends ApiResponse {
4444
body: Reindex_ResponseBody;
4545
}
4646

47-
export interface Reindex_ResponseBody {
48-
batches?: number;
49-
created?: number;
50-
deleted?: number;
51-
failures?: Common.BulkIndexByScrollFailure[];
52-
noops?: number;
53-
requests_per_second?: number;
54-
retries?: Common.Retries;
55-
slice_id?: number;
47+
export type Reindex_ResponseBody = Common.BulkByScrollResponseBase | {
5648
task?: Common.TaskId;
57-
throttled_millis?: Common.EpochTimeUnitMillis;
58-
throttled_until_millis?: Common.EpochTimeUnitMillis;
59-
timed_out?: boolean;
60-
took?: Common.DurationValueUnitMillis;
61-
total?: number;
62-
updated?: number;
63-
version_conflicts?: number;
6449
}
6550

api/_core/search.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export interface Search_RequestBody {
8484
from?: number;
8585
highlight?: Core_Search.Highlight;
8686
indices_boost?: Record<string, number>[];
87-
knn?: Common_QueryDsl.KnnQuery | Common_QueryDsl.KnnQuery[];
8887
min_score?: number;
8988
pit?: Core_Search.PointInTimeReference;
9089
post_filter?: Common_QueryDsl.QueryContainer;

api/_core/updateByQuery.d.ts

+1-16
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,7 @@ export interface UpdateByQuery_Response extends ApiResponse {
7070
body: UpdateByQuery_ResponseBody;
7171
}
7272

73-
export interface UpdateByQuery_ResponseBody {
74-
batches?: number;
75-
deleted?: number;
76-
failures?: Common.BulkIndexByScrollFailure[];
77-
noops?: number;
78-
requests_per_second?: number;
79-
retries?: Common.Retries;
73+
export type UpdateByQuery_ResponseBody = Common.BulkByScrollResponseBase | {
8074
task?: Common.TaskId;
81-
throttled?: Common.Duration;
82-
throttled_millis?: Common.DurationValueUnitMillis;
83-
throttled_until?: Common.Duration;
84-
throttled_until_millis?: Common.DurationValueUnitMillis;
85-
timed_out?: boolean;
86-
took?: Common.DurationValueUnitMillis;
87-
total?: number;
88-
updated?: number;
89-
version_conflicts?: number;
9075
}
9176

0 commit comments

Comments
 (0)