Skip to content

Commit

Permalink
Updated opensearch-js to reflect the latest OpenSearch API spec (2024…
Browse files Browse the repository at this point in the history
…-10-24)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
nhtruong authored and github-actions[bot] committed Oct 24, 2024
1 parent 9288450 commit 0912257
Show file tree
Hide file tree
Showing 444 changed files with 2,523 additions and 2,275 deletions.
11 changes: 11 additions & 0 deletions api/OpenSearchApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,13 @@ export default class OpenSearchAPI {

};

insights: {
topQueries (params: API.Insights_TopQueries_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Insights_TopQueries_Response>;
topQueries (params: API.Insights_TopQueries_Request, callback: callbackFn<API.Insights_TopQueries_Response>): TransportRequestCallback;
topQueries (params: API.Insights_TopQueries_Request, options: TransportRequestOptions, callback: callbackFn<API.Insights_TopQueries_Response>): TransportRequestCallback;

};

ism: {
addPolicy (params?: API.Ism_AddPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_AddPolicy_Response>;
addPolicy (callback: callbackFn<API.Ism_AddPolicy_Response>): TransportRequestCallback;
Expand Down Expand Up @@ -1454,6 +1461,10 @@ export default class OpenSearchAPI {
bulk (params: API.Bulk_Request, callback: callbackFn<API.Bulk_Response>): TransportRequestCallback;
bulk (params: API.Bulk_Request, options: TransportRequestOptions, callback: callbackFn<API.Bulk_Response>): TransportRequestCallback;

bulkStream (params: API.BulkStream_Request, options?: TransportRequestOptions): TransportRequestPromise<API.BulkStream_Response>;
bulkStream (params: API.BulkStream_Request, callback: callbackFn<API.BulkStream_Response>): TransportRequestCallback;
bulkStream (params: API.BulkStream_Request, options: TransportRequestOptions, callback: callbackFn<API.BulkStream_Response>): TransportRequestCallback;

count (params?: API.Count_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Count_Response>;
count (callback: callbackFn<API.Count_Response>): TransportRequestCallback;
count (params: API.Count_Request, callback: callbackFn<API.Count_Response>): TransportRequestCallback;
Expand Down
5 changes: 5 additions & 0 deletions api/OpenSearchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class OpenSearchAPI {
http: new(require('./http/_api'))(this),
indices: new(require('./indices/_api'))(this),
ingest: new(require('./ingest/_api'))(this),
insights: new(require('./insights/_api'))(this),
ism: new(require('./ism/_api'))(this),
knn: new(require('./knn/_api'))(this),
ml: new(require('./ml/_api'))(this),
Expand All @@ -52,6 +53,7 @@ class OpenSearchAPI {
// Setup Root API Functions
/** @namespace API-Core */
this.bulk = require('./_core/bulk').bind(this)
this.bulkStream = require('./_core/bulkStream').bind(this)
this.clearScroll = require('./_core/clearScroll').bind(this)
this.count = require('./_core/count').bind(this)
this.create = require('./_core/create').bind(this)
Expand Down Expand Up @@ -94,6 +96,8 @@ class OpenSearchAPI {
this.updateByQuery = require('./_core/updateByQuery').bind(this)
this.updateByQueryRethrottle = require('./_core/updateByQueryRethrottle').bind(this)

// Deprecated: Use bulkStream instead.
this.bulk_stream = require('./_core/bulkStream').bind(this)
// Deprecated: Use clearScroll instead.
this.clear_scroll = require('./_core/clearScroll').bind(this)
// Deprecated: Use createPit instead.
Expand Down Expand Up @@ -153,6 +157,7 @@ class OpenSearchAPI {
http: { get() { return this[kApiModules].http } },
indices: { get() { return this[kApiModules].indices } },
ingest: { get() { return this[kApiModules].ingest } },
insights: { get() { return this[kApiModules].insights } },
ism: { get() { return this[kApiModules].ism } },
knn: { get() { return this[kApiModules].knn } },
ml: { get() { return this[kApiModules].ml } },
Expand Down
8 changes: 4 additions & 4 deletions api/_core/bulk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as Core_Bulk from '../_types/_core.bulk'
import * as Core_Search from '../_types/_core.search'
import * as Global from '../_types/_global'

export interface Bulk_Request extends Global.Params {
export type Bulk_Request = Global.Params & {
_source?: Core_Search.SourceConfigParam;
_source_excludes?: Common.Fields;
_source_includes?: Common.Fields;
Expand All @@ -29,19 +29,19 @@ export interface Bulk_Request extends Global.Params {
pipeline?: string;
refresh?: Common.Refresh;
require_alias?: boolean;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
timeout?: Common.Duration;
type?: string;
wait_for_active_shards?: Common.WaitForActiveShards;
}

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

export interface Bulk_Response extends ApiResponse {
export type Bulk_Response = ApiResponse & {
body: Bulk_ResponseBody;
}

export interface Bulk_ResponseBody {
export type Bulk_ResponseBody = {
errors: boolean;
ingest_took?: number;
items: Record<string, Core_Bulk.ResponseItem>[];
Expand Down
52 changes: 52 additions & 0 deletions api/_core/bulkStream.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

/*
* This file was generated from the OpenSearch API Spec. Do NOT edit it
* manually. If you want to make changes, either update the spec or
* modify the API generator.
*/

import { ApiResponse } from '../../lib/Transport'
import * as Common from '../_types/_common'
import * as Core_Bulk from '../_types/_core.bulk'
import * as Core_Search from '../_types/_core.search'
import * as Global from '../_types/_global'

export type BulkStream_Request = Global.Params & {
_source?: Core_Search.SourceConfigParam;
_source_excludes?: Common.Fields;
_source_includes?: Common.Fields;
batch_interval?: Common.Duration;
batch_size?: Common.BatchSize;
body: BulkStream_RequestBody;
index?: Common.IndexName;
pipeline?: string;
refresh?: Common.Refresh;
require_alias?: boolean;
routing?: Common.RoutingInQueryString;
timeout?: Common.Duration;
type?: string;
wait_for_active_shards?: Common.WaitForActiveShards;
}

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

export type BulkStream_Response = ApiResponse & {
body: BulkStream_ResponseBody;
}

export type BulkStream_ResponseBody = {
errors: boolean;
ingest_took?: number;
items: Record<string, Core_Bulk.ResponseItem>[];
took: number;
}

61 changes: 61 additions & 0 deletions api/_core/bulkStream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

/*
* This file was generated from the OpenSearch API Spec. Do NOT edit it
* manually. If you want to make changes, either update the spec or
* modify the API generator.
*/

'use strict';

const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils');

/**
* Allows to perform multiple index/update/delete operations using request response streaming.
* <br/> See Also: {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk-streaming/ - bulk_stream}
*
* @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_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 {string} [params.batch_interval] - Specifies for how long bulk operations should be accumulated into a batch before sending the batch to data nodes.
* @param {number} [params.batch_size] - Specifies how many bulk operations should be accumulated into a batch before sending the batch to data nodes.
* @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.
* @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`.
* @param {boolean} [params.require_alias=false] - If `true`, the request's actions must target an index alias.
* @param {string} [params.routing] - Custom value used to route operations to a specific shard.
* @param {string} [params.timeout] - Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
* @param {string} [params.type] - Default document type for items which don't provide one.
* @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`).
* @param {string} [params.index] - Name of the data stream, index, or index alias to perform bulk actions on.
* @param {array} params.body - The operation definition and data (action-data pairs), separated by newlines
*
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}
* @param {function} [callback] - Callback that handles errors and response
*
* @returns {{abort: function(), then: function(), catch: function()}|Promise<never>|*}
*/
function bulkStreamFunc(params, options, callback) {
[params, options, callback] = normalizeArguments(params, options, callback);
if (params.body == null) return handleMissingParam('body', this, callback);

let { body, index, ...querystring } = params;
index = parsePathParam(index);

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

return this.transport.request({ method, path, querystring, bulkBody: body }, options, callback);
}

module.exports = bulkStreamFunc;
8 changes: 4 additions & 4 deletions api/_core/clearScroll.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ import { ApiResponse } from '../../lib/Transport'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface ClearScroll_Request extends Global.Params {
export type ClearScroll_Request = Global.Params & {
body?: ClearScroll_RequestBody;
scroll_id?: Common.ScrollIds;
}

export interface ClearScroll_RequestBody {
export type ClearScroll_RequestBody = {
scroll_id?: Common.ScrollIds;
}

export interface ClearScroll_Response extends ApiResponse {
export type ClearScroll_Response = ApiResponse & {
body: ClearScroll_ResponseBody;
}

export interface ClearScroll_ResponseBody {
export type ClearScroll_ResponseBody = {
num_freed: number;
succeeded: boolean;
}
Expand Down
10 changes: 5 additions & 5 deletions api/_core/count.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as Common from '../_types/_common'
import * as Common_QueryDsl from '../_types/_common.query_dsl'
import * as Global from '../_types/_global'

export interface Count_Request extends Global.Params {
export type Count_Request = Global.Params & {
allow_no_indices?: boolean;
analyze_wildcard?: boolean;
analyzer?: string;
Expand All @@ -34,19 +34,19 @@ export interface Count_Request extends Global.Params {
min_score?: number;
preference?: string;
q?: string;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
terminate_after?: number;
}

export interface Count_RequestBody {
export type Count_RequestBody = {
query?: Common_QueryDsl.QueryContainer;
}

export interface Count_Response extends ApiResponse {
export type Count_Response = ApiResponse & {
body: Count_ResponseBody;
}

export interface Count_ResponseBody {
export type Count_ResponseBody = {
_shards: Common.ShardStatistics;
count: number;
terminated_early?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions api/_core/create.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { ApiResponse } from '../../lib/Transport'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface Create_Request extends Global.Params {
export type Create_Request = Global.Params & {
body: Create_RequestBody;
id: Common.Id;
index: Common.IndexName;
pipeline?: string;
refresh?: Common.Refresh;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
timeout?: Common.Duration;
version?: Common.VersionNumber;
version_type?: Common.VersionType;
Expand All @@ -33,7 +33,7 @@ export interface Create_Request extends Global.Params {

export type Create_RequestBody = Record<string, any>

export interface Create_Response extends ApiResponse {
export type Create_Response = ApiResponse & {
body: Create_ResponseBody;
}

Expand Down
8 changes: 4 additions & 4 deletions api/_core/createPit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ import * as Common from '../_types/_common'
import * as Core_Common from '../_types/_core._common'
import * as Global from '../_types/_global'

export interface CreatePit_Request extends Global.Params {
export type CreatePit_Request = Global.Params & {
allow_partial_pit_creation?: boolean;
expand_wildcards?: Common.ExpandWildcards;
index: string[];
keep_alive?: Common.Duration;
preference?: string;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
}

export interface CreatePit_Response extends ApiResponse {
export type CreatePit_Response = ApiResponse & {
body: CreatePit_ResponseBody;
}

export interface CreatePit_ResponseBody {
export type CreatePit_ResponseBody = {
_shards?: Core_Common.ShardStatistics;
creation_time?: number;
pit_id?: string;
Expand Down
6 changes: 3 additions & 3 deletions api/_core/delete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ import { ApiResponse } from '../../lib/Transport'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface Delete_Request extends Global.Params {
export type Delete_Request = Global.Params & {
id: Common.Id;
if_primary_term?: number;
if_seq_no?: Common.SequenceNumber;
index: Common.IndexName;
refresh?: Common.Refresh;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
timeout?: Common.Duration;
version?: Common.VersionNumber;
version_type?: Common.VersionType;
wait_for_active_shards?: Common.WaitForActiveShards;
}

export interface Delete_Response extends ApiResponse {
export type Delete_Response = ApiResponse & {
body: Delete_ResponseBody;
}

Expand Down
4 changes: 2 additions & 2 deletions api/_core/deleteAllPits.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import * as Global from '../_types/_global'

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

export interface DeleteAllPits_Response extends ApiResponse {
export type DeleteAllPits_Response = ApiResponse & {
body: DeleteAllPits_ResponseBody;
}

export interface DeleteAllPits_ResponseBody {
export type DeleteAllPits_ResponseBody = {
pits?: Core_Common.PitsDetailsDeleteAll[];
}

8 changes: 4 additions & 4 deletions api/_core/deleteByQuery.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as Common from '../_types/_common'
import * as Common_QueryDsl from '../_types/_common.query_dsl'
import * as Global from '../_types/_global'

export interface DeleteByQuery_Request extends Global.Params {
export type DeleteByQuery_Request = Global.Params & {
_source?: string[];
_source_excludes?: string[];
_source_includes?: string[];
Expand All @@ -41,7 +41,7 @@ export interface DeleteByQuery_Request extends Global.Params {
refresh?: boolean;
request_cache?: boolean;
requests_per_second?: number;
routing?: Common.Routing;
routing?: Common.RoutingInQueryString;
scroll?: Common.Duration;
scroll_size?: number;
search_timeout?: Common.Duration;
Expand All @@ -57,13 +57,13 @@ export interface DeleteByQuery_Request extends Global.Params {
wait_for_completion?: boolean;
}

export interface DeleteByQuery_RequestBody {
export type DeleteByQuery_RequestBody = {
max_docs?: number;
query?: Common_QueryDsl.QueryContainer;
slice?: Common.SlicedScroll;
}

export interface DeleteByQuery_Response extends ApiResponse {
export type DeleteByQuery_Response = ApiResponse & {
body: DeleteByQuery_ResponseBody;
}

Expand Down
4 changes: 2 additions & 2 deletions api/_core/deleteByQueryRethrottle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import * as Common from '../_types/_common'
import * as Global from '../_types/_global'
import * as Tasks_Common from '../_types/tasks._common'

export interface DeleteByQueryRethrottle_Request extends Global.Params {
export type DeleteByQueryRethrottle_Request = Global.Params & {
requests_per_second?: number;
task_id: Common.TaskId;
}

export interface DeleteByQueryRethrottle_Response extends ApiResponse {
export type DeleteByQueryRethrottle_Response = ApiResponse & {
body: DeleteByQueryRethrottle_ResponseBody;
}

Expand Down
Loading

0 comments on commit 0912257

Please sign in to comment.