diff --git a/CHANGELOG.md b/CHANGELOG.md index c29c2c3f4..1bb941cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added jsdoc for documentation generation ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) - Documented Transport#request ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) - Documented all API methods ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) +- Added point in time APIs ([#348](https://github.com/opensearch-project/opensearch-js/pull/348)) ### Dependencies - Bumps `xmlbuilder2` from 2.4.1 to 3.0.2 - Bumps `minimatch` from 3.0.4 to 3.1.2 diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 289c10243..3ff5b7453 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -12,6 +12,7 @@ - [Delete the index](#delete-the-index) ## Initializing a Client + ```javascript 'use strict'; @@ -70,14 +71,14 @@ const client = new Client({ }); }), }), - node: "https://search-xxx.region.es.amazonaws.com", // OpenSearch domain URL + node: 'https://search-xxx.region.es.amazonaws.com', // OpenSearch domain URL }); ``` #### Using AWS V3 SDK ```javascript -const { defaultProvider } = require("@aws-sdk/credential-provider-node"); // V3 SDK. +const { defaultProvider } = require('@aws-sdk/credential-provider-node'); // V3 SDK. const { Client } = require('@opensearch-project/opensearch'); const { AwsSigv4Signer } = require('@opensearch-project/opensearch/aws'); @@ -97,101 +98,151 @@ const client = new Client({ return credentialsProvider(); }, }), - node: "https://search-xxx.region.es.amazonaws.com", // OpenSearch domain URL + node: 'https://search-xxx.region.es.amazonaws.com', // OpenSearch domain URL }); ``` ## Create an Index ```javascript - console.log('Creating index:'); - - var index_name = 'books'; - var settings = { - settings: { - index: { - number_of_shards: 4, - number_of_replicas: 3, - }, +console.log('Creating index:'); + +var index_name = 'books'; +var settings = { + settings: { + index: { + number_of_shards: 4, + number_of_replicas: 3, }, - }; + }, +}; - var response = await client.indices.create({ - index: index_name, - body: settings, - }); +var response = await client.indices.create({ + index: index_name, + body: settings, +}); - console.log(response.body); +console.log(response.body); ``` ## Add a Document to the Index ```javascript - console.log('Adding document:'); - - var document = { - title: 'The Outsider', - author: 'Stephen King', - year: '2018', - genre: 'Crime fiction', - }; - - var id = '1'; - - var response = await client.index({ - id: id, - index: index_name, - body: document, - refresh: true, - }); +console.log('Adding document:'); + +var document = { + title: 'The Outsider', + author: 'Stephen King', + year: '2018', + genre: 'Crime fiction', +}; + +var id = '1'; + +var response = await client.index({ + id: id, + index: index_name, + body: document, + refresh: true, +}); - console.log(response.body); +console.log(response.body); ``` ## Search for the Document ```javascript - console.log('Search results:'); - - var query = { - query: { - match: { - title: { - query: 'The Outsider', - }, +console.log('Search results:'); + +var query = { + query: { + match: { + title: { + query: 'The Outsider', }, }, - }; + }, +}; - var response = await client.search({ - index: index_name, - body: query, - }); +var response = await client.search({ + index: index_name, + body: query, +}); - console.log(response.body.hits); +console.log(response.body.hits); ``` ## Delete the document ```javascript - console.log('Deleting document:'); +console.log('Deleting document:'); - var response = await client.delete({ - index: index_name, - id: id, - }); +var response = await client.delete({ + index: index_name, + id: id, +}); - console.log(response.body); +console.log(response.body); ``` ## Delete the index ```javascript - console.log('Deleting index:'); +console.log('Deleting index:'); + +var response = await client.indices.delete({ + index: index_name, +}); + +console.log(response.body); +``` + +## Create a Point in Time + +```javascript +console.log('Creating a PIT:'); + +var response = await client.createPit({ + index: 'books*', + keep_alive: '100m', + expand_wildcards: 'all', +}); + +console.log(response.body); +``` + +## Get all PITs + +```javascript +console.log('Getting all PITs:'); + +var response = await client.getAllPits(); + +console.log(response.body); +``` + +## Delete a Point in Time + +```javascript +console.log('Deleting a PIT:'); + +var response = await client.deletePit({ + body: { + pit_id: [ + 'o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA', + ], + }, +}); + +console.log(response.body); +``` + +## Delete all PITs + +```javascript +console.log('Deleting all PITs:'); - var response = await client.indices.delete({ - index: index_name, - }); +var response = await client.deleteAllPits(); - console.log(response.body); +console.log(response.body); ``` \ No newline at end of file diff --git a/api/api/create_pit.js b/api/api/create_pit.js new file mode 100644 index 000000000..cb9269ddd --- /dev/null +++ b/api/api/create_pit.js @@ -0,0 +1,86 @@ +/* + * 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. + * + */ + +'use strict'; + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); +const acceptedQuerystring = [ + 'allow_partial_pit_creation', + 'keep_alive', + 'preference', + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path', +]; +const snakeCase = { + allowPartialPitCreation: 'allow_partial_pit_creation', + keepAlive: 'keep_alive', + errorTrace: 'error_trace', + filterPath: 'filter_path', +}; + +/** + * Creates a point in time. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#create-a-pit|Opensearch - Create a PIT} + * @memberOf API-PIT + * + * @param {Object} params + * @param {string} params.index - The name(s) of the target index(es) for the PIT. May contain a comma-separated list or a wildcard index pattern. + * @param {string} params.keep_alive - The amount of time to keep the PIT + * @param {string} [params.preference=random] - The node or the shard used to perform the search. + * @param {string} [params.routing] - Specifies to route search requests to a specific shard. + * @param {string} [params.expand_wildcards=open] - The type of index that can match the wildcard pattern. Supports comma-separated values. + * @param {string} [params.allow_partial_pit_creation=false] - Specifies whether to create a PIT with partial failures. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response|Create PIT Response} + */ + +function createPitApi(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + // check required parameters + if (params['index'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: index'); + return handleError(err, callback); + } + + if (params['keep_alive'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: keep_alive'); + return handleError(err, callback); + } + + let { method, body, index, ...querystring } = params; + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring); + + let path = ''; + if (method == null) method = 'POST'; + path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'point_in_time'; + + // build request object + const request = { + method, + path, + body: body || '', + querystring, + }; + + return this.transport.request(request, options, callback); +} + +module.exports = createPitApi; diff --git a/api/api/delete_all_pits.js b/api/api/delete_all_pits.js new file mode 100644 index 000000000..dcb582f48 --- /dev/null +++ b/api/api/delete_all_pits.js @@ -0,0 +1,53 @@ +/* + * 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. + * + */ + +'use strict'; + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); +const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; +const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; + +/** + * Deletes all PITs in the OpenSearch cluster. The Delete All PITs API deletes only local PITs or mixed PITs (PITs created in both local and remote clusters). It does not delete fully remote PITs. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#delete-pits|Opensearch - Delete PITs} + * @memberOf API-PIT + * + * @param {Object} params + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response-2|Delete all PITs Response} + */ +function deleteAllPitsApi(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { method, body, ...querystring } = params; + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring); + + let path = ''; + if (method == null) method = 'DELETE'; + path = '/' + '_search' + '/' + 'point_in_time' + '/' + '_all'; + + // build request object + const request = { + method, + path, + body: body || '', + querystring, + }; + + return this.transport.request(request, options, callback); +} + +module.exports = deleteAllPitsApi; diff --git a/api/api/delete_pit.js b/api/api/delete_pit.js new file mode 100644 index 000000000..52e3e8ff1 --- /dev/null +++ b/api/api/delete_pit.js @@ -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. + * + */ + +'use strict'; + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); +const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; +const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; + +/** + * Deletes one or several PITs. PITs are automatically deleted when the keep_alive time period elapses. However, to deallocate resources, you can delete a PIT using the Delete PIT API. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#delete-pits|Opensearch - Delete PITs} + * @memberOf API-PIT + * + * @param {Object} params + * @param {Object} params.body + * @param {string[]} params.body.pit_id - The PIT IDs of the PITs to be deleted. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response-2|Delete PIT Response} + */ +function deletePitApi(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + // check required parameters + if (params['body'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: body'); + return handleError(err, callback); + } + + let { method, body, ...querystring } = params; + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring); + + let path = ''; + if (method == null) method = 'DELETE'; + path = '/' + '_search' + '/' + 'point_in_time'; + + // build request object + const request = { + method, + path, + body: body || '', + querystring, + }; + + return this.transport.request(request, options, callback); +} + +module.exports = deletePitApi; diff --git a/api/api/get_all_pits.js b/api/api/get_all_pits.js new file mode 100644 index 000000000..4819c4c4a --- /dev/null +++ b/api/api/get_all_pits.js @@ -0,0 +1,53 @@ +/* + * 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. + * + */ + +'use strict'; + +/* eslint camelcase: 0 */ +/* eslint no-unused-vars: 0 */ + +const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); +const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; +const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; + +/** + * Returns all PITs in the OpenSearch cluster. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#list-all-pits|Opensearch - List all PITs} + * @memberOf API-PIT + * + * @param {Object} params + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/opensearch/point-in-time-api#sample-response-1|List all PITs Response} + */ +function getAllPitsApi(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { method, body, ...querystring } = params; + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring); + + let path = ''; + if (method == null) method = 'GET'; + path = '/' + '_search' + '/' + 'point_in_time' + '/' + '_all'; + + // build request object + const request = { + method, + path, + body: null, + querystring, + }; + + return this.transport.request(request, options, callback); +} + +module.exports = getAllPitsApi; diff --git a/api/index.js b/api/index.js index afd231c98..8f58c93f5 100644 --- a/api/index.js +++ b/api/index.js @@ -35,10 +35,13 @@ const clearScrollApi = require('./api/clear_scroll'); const ClusterApi = require('./api/cluster'); const countApi = require('./api/count'); const createApi = require('./api/create'); +const createPitApi = require('./api/create_pit'); const DanglingIndicesApi = require('./api/dangling_indices'); const deleteApi = require('./api/delete'); +const deleteAllPitsApi = require('./api/delete_all_pits'); const deleteByQueryApi = require('./api/delete_by_query'); const deleteByQueryRethrottleApi = require('./api/delete_by_query_rethrottle'); +const deletePitApi = require('./api/delete_pit'); const deleteScriptApi = require('./api/delete_script'); const existsApi = require('./api/exists'); const existsSourceApi = require('./api/exists_source'); @@ -46,6 +49,7 @@ const explainApi = require('./api/explain'); const FeaturesApi = require('./api/features'); const fieldCapsApi = require('./api/field_caps'); const getApi = require('./api/get'); +const getAllPitsApi = require('./api/get_all_pits'); const getScriptApi = require('./api/get_script'); const getScriptContextApi = require('./api/get_script_context'); const getScriptLanguagesApi = require('./api/get_script_languages'); @@ -109,15 +113,19 @@ OpenSearchAPI.prototype.bulk = bulkApi; OpenSearchAPI.prototype.clearScroll = clearScrollApi; OpenSearchAPI.prototype.count = countApi; OpenSearchAPI.prototype.create = createApi; +OpenSearchAPI.prototype.createPit = createPitApi; OpenSearchAPI.prototype.delete = deleteApi; +OpenSearchAPI.prototype.deleteAllPits = deleteAllPitsApi; OpenSearchAPI.prototype.deleteByQuery = deleteByQueryApi; OpenSearchAPI.prototype.deleteByQueryRethrottle = deleteByQueryRethrottleApi; +OpenSearchAPI.prototype.deletePit = deletePitApi; OpenSearchAPI.prototype.deleteScript = deleteScriptApi; OpenSearchAPI.prototype.exists = existsApi; OpenSearchAPI.prototype.existsSource = existsSourceApi; OpenSearchAPI.prototype.explain = explainApi; OpenSearchAPI.prototype.fieldCaps = fieldCapsApi; OpenSearchAPI.prototype.get = getApi; +OpenSearchAPI.prototype.getAllPits = getAllPitsApi; OpenSearchAPI.prototype.getScript = getScriptApi; OpenSearchAPI.prototype.getScriptContext = getScriptContextApi; OpenSearchAPI.prototype.getScriptLanguages = getScriptLanguagesApi; @@ -167,6 +175,11 @@ Object.defineProperties(OpenSearchAPI.prototype, { return this[kCluster]; }, }, + create_pit: { + get() { + return this.createPit; + }, + }, danglingIndices: { get() { if (this[kDanglingIndices] === null) { @@ -180,6 +193,11 @@ Object.defineProperties(OpenSearchAPI.prototype, { return this.danglingIndices; }, }, + delete_all_pits: { + get() { + return this.deleteAllPits; + }, + }, delete_by_query: { get() { return this.deleteByQuery; @@ -190,6 +208,11 @@ Object.defineProperties(OpenSearchAPI.prototype, { return this.deleteByQueryRethrottle; }, }, + delete_pit: { + get() { + return this.deletePit; + }, + }, delete_script: { get() { return this.deleteScript; @@ -213,6 +236,11 @@ Object.defineProperties(OpenSearchAPI.prototype, { return this.fieldCaps; }, }, + get_all_pits: { + get() { + return this.getAllPits; + }, + }, get_script: { get() { return this.getScript; diff --git a/api/new.d.ts b/api/new.d.ts index ea2178a31..782f06725 100644 --- a/api/new.d.ts +++ b/api/new.d.ts @@ -487,6 +487,22 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + createPit( + params?: T.PointInTimeCreateRequest, + options?: TransportRequestOptions + ): TransportRequestPromise>; + createPit( + callback: callbackFn + ): TransportRequestCallback; + createPit( + params: T.PointInTimeCreateRequest, + callback: callbackFn + ): TransportRequestCallback; + createPit( + params: T.PointInTimeCreateRequest, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; danglingIndices: { deleteDanglingIndex( params?: TODO, @@ -550,6 +566,22 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + deleteAllPits( + params?: T.PointInTimeDeleteAllRequest, + options?: TransportRequestOptions + ): TransportRequestPromise>; + deleteAllPits( + callback: callbackFn + ): TransportRequestCallback; + deleteAllPits( + params: T.PointInTimeDeleteAllRequest, + callback: callbackFn + ): TransportRequestCallback; + deleteAllPits( + params: T.PointInTimeDeleteAllRequest, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; deleteByQuery( params: T.DeleteByQueryRequest, options?: TransportRequestOptions @@ -576,6 +608,22 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + deletePit( + params?: T.PointInTimeDeleteRequest, + options?: TransportRequestOptions + ): TransportRequestPromise>; + deletePit( + callback: callbackFn + ): TransportRequestCallback; + deletePit( + params: T.PointInTimeDeleteRequest, + callback: callbackFn + ): TransportRequestCallback; + deletePit( + params: T.PointInTimeDeleteRequest, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; deleteScript( params: T.DeleteScriptRequest, options?: TransportRequestOptions @@ -689,6 +737,22 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn, TContext> ): TransportRequestCallback; + getAllPits( + params?: T.PointInTimeGetAllRequest, + options?: TransportRequestOptions + ): TransportRequestPromise>; + getAllPits( + callback: callbackFn + ): TransportRequestCallback; + getAllPits( + params: T.PointInTimeGetAllRequest, + callback: callbackFn + ): TransportRequestCallback; + getAllPits( + params: T.PointInTimeGetAllRequest, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; getScript( params: T.GetScriptRequest, options?: TransportRequestOptions diff --git a/api/opensearch_dashboards.d.ts b/api/opensearch_dashboards.d.ts index 11423b8c5..67dbb9756 100644 --- a/api/opensearch_dashboards.d.ts +++ b/api/opensearch_dashboards.d.ts @@ -136,14 +136,17 @@ interface OpenSearchDashboardsClient { } count(params?: T.CountRequest, options?: TransportRequestOptions): TransportRequestPromise> create(params: T.CreateRequest, options?: TransportRequestOptions): TransportRequestPromise> + createPit(params?: T.PointInTimeCreateRequest, options?: TransportRequestOptions): TransportRequestPromise> danglingIndices: { deleteDanglingIndex(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise> importDanglingIndex(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise> listDanglingIndices(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise> } delete(params: T.DeleteRequest, options?: TransportRequestOptions): TransportRequestPromise> + deleteAllPits(params: T.PointInTimeDeleteAllRequest, options?: TransportRequestOptions): TransportRequestPromise> deleteByQuery(params: T.DeleteByQueryRequest, options?: TransportRequestOptions): TransportRequestPromise> deleteByQueryRethrottle(params: T.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): TransportRequestPromise> + deletePit(params: T.PointInTimeDeleteRequest, options?: TransportRequestOptions): TransportRequestPromise> deleteScript(params: T.DeleteScriptRequest, options?: TransportRequestOptions): TransportRequestPromise> exists(params: T.ExistsRequest, options?: TransportRequestOptions): TransportRequestPromise> existsSource(params: T.ExistsSourceRequest, options?: TransportRequestOptions): TransportRequestPromise> @@ -154,6 +157,7 @@ interface OpenSearchDashboardsClient { } fieldCaps(params?: T.FieldCapsRequest, options?: TransportRequestOptions): TransportRequestPromise> get(params: T.GetRequest, options?: TransportRequestOptions): TransportRequestPromise, TContext>> + getAllPits(params: T.PointInTimeGetAllRequest, options?: TransportRequestOptions): TransportRequestPromise> getScript(params: T.GetScriptRequest, options?: TransportRequestOptions): TransportRequestPromise> getScriptContext(params?: T.GetScriptContextRequest, options?: TransportRequestOptions): TransportRequestPromise> getScriptLanguages(params?: T.GetScriptLanguagesRequest, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 9c9e4b1bb..3afc4fc57 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -523,6 +523,14 @@ export interface Create extends Generic { body: T; } +export interface CreatePit extends Generic { + index: string | string[]; + allow_partial_pit_creation?: boolean; + keep_alive: string; + preference?: string; + routing?: string | string[]; +} + export interface DanglingIndicesDeleteDanglingIndex extends Generic { index_uuid: string; accept_data_loss?: boolean; @@ -560,6 +568,8 @@ export interface Delete extends Generic { version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } +export interface DeleteAllPits extends Generic { } + export interface DeleteByQuery extends Generic { index: string | string[]; _source_exclude?: string | string[]; @@ -605,6 +615,10 @@ export interface DeleteByQueryRethrottle extends Generic { requests_per_second: number; } +export interface DeletePit extends Generic { + body: T; +} + export interface DeleteScript extends Generic { id: string; timeout?: string; @@ -705,6 +719,8 @@ export interface Get extends Generic { version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } +export interface GetAllPits extends Generic { } + export interface GetScript extends Generic { id: string; cluster_manager_timeout?: string; diff --git a/api/types.d.ts b/api/types.d.ts index 7b7b4c29c..f0b0fe6e1 100644 --- a/api/types.d.ts +++ b/api/types.d.ts @@ -9963,3 +9963,50 @@ export interface SpecUtilsCommonCatQueryParameters { s?: string[] v?: boolean } + +export interface PointInTime { + pit_id: string; + creation_time: Time; + keep_alive: Time +} + +export interface PointInTimeDelete { + pit_id: string; + successful: boolean +} + +export interface PointInTimeCreateRequest extends RequestBase { + index: Indices; + keep_alive: string; + preference?: string; + routing?: string; + expand_wildcards?: ExpandWildcards; + allow_partial_pit_creation?: boolean +} + +export interface PointInTimeCreateResponse extends ShardsOperationResponseBase { + pit_id: string; + creation_time: Time; +} + +export interface PointInTimeGetAllRequest extends RequestBase { } + +export interface PointInTimeGetAllResponse { + pits: PointInTime[]; +} + +export interface PointInTimeDeleteAllRequest extends RequestBase { } + +export interface PointInTimeDeleteAllResponse { + pits: PointInTimeDelete[]; +} + +export interface PointInTimeDeleteRequest extends RequestBase { + body?: { + pit_id: string[] + }; +} + +export interface PointInTimeDeleteResponse { + pits: PointInTimeDelete[]; +} diff --git a/index.d.ts b/index.d.ts index f25917f6f..2adf63aa3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1228,6 +1228,38 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + create_pit, TContext = Context>( + params?: RequestParams.CreatePit, + options?: TransportRequestOptions + ): TransportRequestPromise>; + create_pit, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + create_pit, TContext = Context>( + params: RequestParams.CreatePit, + callback: callbackFn + ): TransportRequestCallback; + create_pit, TContext = Context>( + params: RequestParams.CreatePit, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; + createPit, TContext = Context>( + params?: RequestParams.CreatePit, + options?: TransportRequestOptions + ): TransportRequestPromise>; + createPit, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + createPit, TContext = Context>( + params: RequestParams.CreatePit, + callback: callbackFn + ): TransportRequestCallback; + createPit, TContext = Context>( + params: RequestParams.CreatePit, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; dangling_indices: { delete_dangling_index, TContext = Context>( params?: RequestParams.DanglingIndicesDeleteDanglingIndex, @@ -1440,6 +1472,38 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + delete_all_pits, TContext = Context>( + params?: RequestParams.DeleteAllPits, + options?: TransportRequestOptions + ): TransportRequestPromise>; + delete_all_pits, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + delete_all_pits, TContext = Context>( + params: RequestParams.DeleteAllPits, + callback: callbackFn + ): TransportRequestCallback; + delete_all_pits, TContext = Context>( + params: RequestParams.DeleteAllPits, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; + deleteAllPits, TContext = Context>( + params?: RequestParams.DeleteAllPits, + options?: TransportRequestOptions + ): TransportRequestPromise>; + deleteAllPits, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + deleteAllPits, TContext = Context>( + params: RequestParams.DeleteAllPits, + callback: callbackFn + ): TransportRequestCallback; + deleteAllPits, TContext = Context>( + params: RequestParams.DeleteAllPits, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; delete_by_query< TResponse = Record, TRequestBody extends RequestBody = Record, @@ -1532,6 +1596,70 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + delete_pit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params?: RequestParams.DeletePit, + options?: TransportRequestOptions + ): TransportRequestPromise>; + delete_pit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + callback: callbackFn + ): TransportRequestCallback; + delete_pit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params: RequestParams.DeletePit, + callback: callbackFn + ): TransportRequestCallback; + delete_pit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params: RequestParams.DeletePit, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; + deletePit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params?: RequestParams.DeletePit, + options?: TransportRequestOptions + ): TransportRequestPromise>; + deletePit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + callback: callbackFn + ): TransportRequestCallback; + deletePit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params: RequestParams.DeletePit, + callback: callbackFn + ): TransportRequestCallback; + deletePit< + TResponse = Record, + TRequestBody extends RequestBody = Record, + TContext = Context + >( + params: RequestParams.DeletePit, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; delete_script, TContext = Context>( params?: RequestParams.DeleteScript, options?: TransportRequestOptions @@ -1784,6 +1912,38 @@ declare class Client { options: TransportRequestOptions, callback: callbackFn ): TransportRequestCallback; + get_all_pits, TContext = Context>( + params?: RequestParams.GetAllPits, + options?: TransportRequestOptions + ): TransportRequestPromise>; + get_all_pits, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + get_all_pits, TContext = Context>( + params: RequestParams.GetAllPits, + callback: callbackFn + ): TransportRequestCallback; + get_all_pits, TContext = Context>( + params: RequestParams.GetAllPits, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; + getAllPits, TContext = Context>( + params?: RequestParams.GetAllPits, + options?: TransportRequestOptions + ): TransportRequestPromise>; + getAllPits, TContext = Context>( + callback: callbackFn + ): TransportRequestCallback; + getAllPits, TContext = Context>( + params: RequestParams.GetAllPits, + callback: callbackFn + ): TransportRequestCallback; + getAllPits, TContext = Context>( + params: RequestParams.GetAllPits, + options: TransportRequestOptions, + callback: callbackFn + ): TransportRequestCallback; get_script, TContext = Context>( params?: RequestParams.GetScript, options?: TransportRequestOptions