Skip to content

Commit

Permalink
[AUTOCUT] Update opensearch-js to reflect the latest OpenSearch API s…
Browse files Browse the repository at this point in the history
…pec (2024-11-18) (#924)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: nhtruong <644650+nhtruong@users.noreply.github.com>
  • Loading branch information
opensearch-trigger-bot[bot] and nhtruong authored Nov 18, 2024
1 parent 3a44a33 commit 72163fe
Show file tree
Hide file tree
Showing 186 changed files with 1,415 additions and 273 deletions.
50 changes: 50 additions & 0 deletions api/OpenSearchApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,56 @@ export default class OpenSearchAPI {

};

replication: {
deleteReplicationRule (params: API.Replication_DeleteReplicationRule_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_DeleteReplicationRule_Response>;
deleteReplicationRule (params: API.Replication_DeleteReplicationRule_Request, callback: callbackFn<API.Replication_DeleteReplicationRule_Response>): TransportRequestCallback;
deleteReplicationRule (params: API.Replication_DeleteReplicationRule_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_DeleteReplicationRule_Response>): TransportRequestCallback;

createReplicationRule (params: API.Replication_CreateReplicationRule_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_CreateReplicationRule_Response>;
createReplicationRule (params: API.Replication_CreateReplicationRule_Request, callback: callbackFn<API.Replication_CreateReplicationRule_Response>): TransportRequestCallback;
createReplicationRule (params: API.Replication_CreateReplicationRule_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_CreateReplicationRule_Response>): TransportRequestCallback;

pause (params: API.Replication_Pause_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_Pause_Response>;
pause (params: API.Replication_Pause_Request, callback: callbackFn<API.Replication_Pause_Response>): TransportRequestCallback;
pause (params: API.Replication_Pause_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_Pause_Response>): TransportRequestCallback;

resume (params: API.Replication_Resume_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_Resume_Response>;
resume (params: API.Replication_Resume_Request, callback: callbackFn<API.Replication_Resume_Response>): TransportRequestCallback;
resume (params: API.Replication_Resume_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_Resume_Response>): TransportRequestCallback;

start (params: API.Replication_Start_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_Start_Response>;
start (params: API.Replication_Start_Request, callback: callbackFn<API.Replication_Start_Response>): TransportRequestCallback;
start (params: API.Replication_Start_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_Start_Response>): TransportRequestCallback;

status (params: API.Replication_Status_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_Status_Response>;
status (params: API.Replication_Status_Request, callback: callbackFn<API.Replication_Status_Response>): TransportRequestCallback;
status (params: API.Replication_Status_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_Status_Response>): TransportRequestCallback;

stop (params: API.Replication_Stop_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_Stop_Response>;
stop (params: API.Replication_Stop_Request, callback: callbackFn<API.Replication_Stop_Response>): TransportRequestCallback;
stop (params: API.Replication_Stop_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_Stop_Response>): TransportRequestCallback;

updateSettings (params: API.Replication_UpdateSettings_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_UpdateSettings_Response>;
updateSettings (params: API.Replication_UpdateSettings_Request, callback: callbackFn<API.Replication_UpdateSettings_Response>): TransportRequestCallback;
updateSettings (params: API.Replication_UpdateSettings_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_UpdateSettings_Response>): TransportRequestCallback;

autofollowStats (params?: API.Replication_AutofollowStats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_AutofollowStats_Response>;
autofollowStats (callback: callbackFn<API.Replication_AutofollowStats_Response>): TransportRequestCallback;
autofollowStats (params: API.Replication_AutofollowStats_Request, callback: callbackFn<API.Replication_AutofollowStats_Response>): TransportRequestCallback;
autofollowStats (params: API.Replication_AutofollowStats_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_AutofollowStats_Response>): TransportRequestCallback;

followerStats (params?: API.Replication_FollowerStats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_FollowerStats_Response>;
followerStats (callback: callbackFn<API.Replication_FollowerStats_Response>): TransportRequestCallback;
followerStats (params: API.Replication_FollowerStats_Request, callback: callbackFn<API.Replication_FollowerStats_Response>): TransportRequestCallback;
followerStats (params: API.Replication_FollowerStats_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_FollowerStats_Response>): TransportRequestCallback;

leaderStats (params?: API.Replication_LeaderStats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Replication_LeaderStats_Response>;
leaderStats (callback: callbackFn<API.Replication_LeaderStats_Response>): TransportRequestCallback;
leaderStats (params: API.Replication_LeaderStats_Request, callback: callbackFn<API.Replication_LeaderStats_Response>): TransportRequestCallback;
leaderStats (params: API.Replication_LeaderStats_Request, options: TransportRequestOptions, callback: callbackFn<API.Replication_LeaderStats_Response>): TransportRequestCallback;

};

rollups: {
delete (params: API.Rollups_Delete_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Rollups_Delete_Response>;
delete (params: API.Rollups_Delete_Request, callback: callbackFn<API.Rollups_Delete_Response>): TransportRequestCallback;
Expand Down
2 changes: 2 additions & 0 deletions api/OpenSearchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class OpenSearchAPI {
ppl: new(require('./ppl/_api'))(this),
query: new(require('./query/_api'))(this),
remoteStore: new(require('./remoteStore/_api'))(this),
replication: new(require('./replication/_api'))(this),
rollups: new(require('./rollups/_api'))(this),
searchPipeline: new(require('./searchPipeline/_api'))(this),
security: new(require('./security/_api'))(this),
Expand Down Expand Up @@ -170,6 +171,7 @@ class OpenSearchAPI {
ppl: { get() { return this[kApiModules].ppl } },
query: { get() { return this[kApiModules].query } },
remoteStore: { get() { return this[kApiModules].remoteStore } },
replication: { get() { return this[kApiModules].replication } },
rollups: { get() { return this[kApiModules].rollups } },
searchPipeline: { get() { return this[kApiModules].searchPipeline } },
security: { get() { return this[kApiModules].security } },
Expand Down
2 changes: 1 addition & 1 deletion api/_core/bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function bulkFunc(params, options, callback) {
let { body, index, ...querystring } = params;
index = parsePathParam(index);

const path = ['/', index, '/_bulk'].filter(c => c).join('').replace('//', '/');
const path = ['', index, '_bulk'].filter(c => c != null).join('/');
const method = index == null ? 'POST' : 'PUT';

return this.transport.request({ method, path, querystring, bulkBody: body }, options, callback);
Expand Down
2 changes: 1 addition & 1 deletion api/_core/bulkStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function bulkStreamFunc(params, options, callback) {
let { body, index, ...querystring } = params;
index = parsePathParam(index);

const path = ['/', index, '/_bulk/stream'].filter(c => c).join('').replace('//', '/');
const path = ['', index, '_bulk/stream'].filter(c => c != null).join('/');
const method = index == null ? 'POST' : 'PUT';

return this.transport.request({ method, path, querystring, bulkBody: body }, options, callback);
Expand Down
2 changes: 1 addition & 1 deletion api/_core/clearScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function clearScrollFunc(params, options, callback) {
let { body, scroll_id, ...querystring } = params;
scroll_id = parsePathParam(scroll_id);

const path = ['/_search/scroll/', scroll_id].filter(c => c).join('').replace('//', '/');
const path = ['/_search/scroll', scroll_id].filter(c => c != null).join('/');
const method = 'DELETE';
body = body || '';

Expand Down
2 changes: 1 addition & 1 deletion api/_core/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function countFunc(params, options, callback) {
let { body, index, ...querystring } = params;
index = parsePathParam(index);

const path = ['/', index, '/_count'].filter(c => c).join('').replace('//', '/');
const path = ['', index, '_count'].filter(c => c != null).join('/');
const method = body ? 'POST' : 'GET';
body = body || '';

Expand Down
2 changes: 1 addition & 1 deletion api/_core/deleteByQuery.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type DeleteByQuery_Request = Global.Params & {
max_docs?: number;
preference?: string;
q?: string;
refresh?: boolean;
refresh?: Common.Refresh;
request_cache?: boolean;
requests_per_second?: number;
routing?: Common.RoutingInQueryString;
Expand Down
10 changes: 5 additions & 5 deletions api/_core/deleteByQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @memberOf API-Core
*
* @param {object} params
* @param {array} [params._source] - True or false to return the _source field or not, or a list of fields to return.
* @param {array} [params._source_excludes] - List of fields to exclude from the returned _source field.
* @param {array} [params._source_includes] - List of fields to extract and return from the _source field.
* @param {array} [params._source] - Set to `true` or `false` to return the `_source` field or not, or a list of fields to return.
* @param {array} [params._source_excludes] - List of fields to exclude from the returned `_source` field.
* @param {array} [params._source_includes] - List of fields to extract and return from the `_source` field.
* @param {boolean} [params.allow_no_indices] - If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.
* @param {boolean} [params.analyze_wildcard=false] - If `true`, wildcard and prefix queries are analyzed.
* @param {string} [params.analyzer] - Analyzer to use for the query string.
Expand All @@ -41,15 +41,15 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @param {number} [params.max_docs] - Maximum number of documents to process. Defaults to all documents.
* @param {string} [params.preference=random] - Specifies the node or shard the operation should be performed on. Random by default.
* @param {string} [params.q] - Query in the Lucene query string syntax.
* @param {boolean} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {string} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {boolean} [params.request_cache] - If `true`, the request cache is used for this request. Defaults to the index-level setting.
* @param {number} [params.requests_per_second=0] - The throttle for this request in sub-requests per second.
* @param {string} [params.routing] - Custom value used to route operations to a specific shard.
* @param {string} [params.scroll] - Period to retain the search context for scrolling.
* @param {number} [params.scroll_size=100] - Size of the scroll request that powers the operation.
* @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout.
* @param {string} [params.search_type] - The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`.
* @param {number} [params.size] - Deprecated, please use `max_docs` instead.
* @param {number} [params.size] - Deprecated, use `max_docs` instead.
* @param {string} [params.slices] - The number of slices this task should be divided into.
* @param {array} [params.sort] - A comma-separated list of <field>:<direction> pairs.
* @param {array} [params.stats] - Specific `tag` of the request for logging and statistical purposes.
Expand Down
2 changes: 1 addition & 1 deletion api/_core/deleteScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
*
* @param {object} params
* @param {string} [params.cluster_manager_timeout] - Operation timeout for connection to cluster-manager node.
* @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.
* @param {string} [params.master_timeout] DEPRECATED - Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error.
* @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.
* @param {string} params.id - Identifier for the stored script or search template.
*
Expand Down
2 changes: 1 addition & 1 deletion api/_core/exists.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Exists_Request = Global.Params & {
index: Common.IndexName;
preference?: string;
realtime?: boolean;
refresh?: boolean;
refresh?: Common.Refresh;
routing?: Common.RoutingInQueryString;
stored_fields?: Common.Fields;
version?: Common.VersionNumber;
Expand Down
2 changes: 1 addition & 1 deletion api/_core/exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @param {string} [params._source_includes] - A comma-separated list of source fields to include in the response.
* @param {string} [params.preference=random] - Specifies the node or shard the operation should be performed on. Random by default.
* @param {boolean} [params.realtime] - If `true`, the request is real-time as opposed to near-real-time.
* @param {boolean} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {string} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {string} [params.routing] - Target the specified primary shard.
* @param {string} [params.stored_fields] - List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to false.
* @param {number} [params.version] - Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.
Expand Down
2 changes: 1 addition & 1 deletion api/_core/existsSource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type ExistsSource_Request = Global.Params & {
index: Common.IndexName;
preference?: string;
realtime?: boolean;
refresh?: boolean;
refresh?: Common.Refresh;
routing?: Common.RoutingInQueryString;
version?: Common.VersionNumber;
version_type?: Common.VersionType;
Expand Down
4 changes: 2 additions & 2 deletions api/_core/existsSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the response.
* @param {string} [params._source_includes] - A comma-separated list of source fields to include in the response.
* @param {string} [params.preference=random] - Specifies the node or shard the operation should be performed on. Random by default.
* @param {boolean} [params.realtime] - If true, the request is real-time as opposed to near-real-time.
* @param {boolean} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {boolean} [params.realtime] - If `true`, the request is real-time as opposed to near-real-time.
* @param {string} [params.refresh] - If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
* @param {string} [params.routing] - Target the specified primary shard.
* @param {number} [params.version] - Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.
* @param {string} [params.version_type] - Specific version type: `external`, `external_gte`.
Expand Down
2 changes: 1 addition & 1 deletion api/_core/explain.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @memberOf API-Core
*
* @param {object} params
* @param {string} [params._source] - True or false to return the `_source` field or not, or a list of fields to return.
* @param {string} [params._source] - Set to `true` or `false` to return the `_source` field or not, or a list of fields to return.
* @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude from the response.
* @param {string} [params._source_includes] - A comma-separated list of source fields to include in the response.
* @param {boolean} [params.analyze_wildcard=false] - If `true`, wildcard and prefix queries are analyzed.
Expand Down
8 changes: 4 additions & 4 deletions api/_core/fieldCaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const { normalizeArguments, parsePathParam } = require('../utils');
* @memberOf API-Core
*
* @param {object} [params]
* @param {boolean} [params.allow_no_indices] - If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar.
* @param {boolean} [params.allow_no_indices] - If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar.
* @param {string} [params.expand_wildcards] - Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`.
* @param {string} [params.fields] - Comma-separated list of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported.
* @param {boolean} [params.ignore_unavailable] - If `true`, missing or closed indexes are not included in the response.
* @param {boolean} [params.include_unmapped=false] - If true, unmapped fields are included in the response.
* @param {string} [params.index] - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indexes, omit this parameter or use * or _all.
* @param {boolean} [params.include_unmapped=false] - If `true`, unmapped fields are included in the response.
* @param {string} [params.index] - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indexes, omit this parameter or use * or `_all`.
* @param {object} [params.body] - An index filter specified with the Query DSL
*
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}
Expand All @@ -44,7 +44,7 @@ function fieldCapsFunc(params, options, callback) {
let { body, index, ...querystring } = params;
index = parsePathParam(index);

const path = ['/', index, '/_field_caps'].filter(c => c).join('').replace('//', '/');
const path = ['', index, '_field_caps'].filter(c => c != null).join('/');
const method = body ? 'POST' : 'GET';
body = body || '';

Expand Down
2 changes: 1 addition & 1 deletion api/_core/get.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type Get_Request = Global.Params & {
index: Common.IndexName;
preference?: string;
realtime?: boolean;
refresh?: boolean;
refresh?: Common.Refresh;
routing?: Common.RoutingInQueryString;
stored_fields?: Common.Fields;
version?: Common.VersionNumber;
Expand Down
Loading

0 comments on commit 72163fe

Please sign in to comment.