Compare commits

...

13 Commits
7.17 ... v7.9.0

Author SHA1 Message Date
2907a84334 Bumped v7.9.0 2020-08-19 17:56:57 +02:00
d966a06a62 API generation 2020-08-19 17:54:32 +02:00
4bca80bafc API generation 2020-08-03 12:02:03 +02:00
080c3af904 Generate response type as boolean if the request is HEAD only (#1275) 2020-08-03 11:54:42 +02:00
14536d6855 API generation 2020-07-29 08:32:03 +02:00
11b4cea493 Bumped v7.9.0-rc.2 2020-07-20 16:48:44 +02:00
3673255959 API generation 2020-07-20 14:10:27 +02:00
e0fc57766d Fix errors in type definitions (#1263) 2020-07-20 14:03:13 +02:00
9c2ec755d3 Bumped v7.9.0-rc.1 2020-07-17 08:46:29 +02:00
a221a84a58 Updated ci configuration 2020-07-17 08:12:53 +02:00
7d78dceed5 Fixed type test 2020-07-15 15:48:58 +02:00
c3832dc081 Updated ci configuration 2020-07-15 15:44:17 +02:00
af5c978131 API generation 2020-07-15 15:43:04 +02:00
33 changed files with 440 additions and 232 deletions

View File

@ -1,6 +1,6 @@
---
STACK_VERSION:
- 7.x-SNAPSHOT
- 7.9.0-SNAPSHOT
NODE_JS_VERSION:
- 14

View File

@ -86,7 +86,7 @@ jobs:
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.x-SNAPSHOT
stack-version: 7.9.0-SNAPSHOT
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1

View File

@ -38,7 +38,9 @@ function buildAsyncSearchSubmit (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'suggest_field',
@ -71,7 +73,9 @@ function buildAsyncSearchSubmit (opts) {
expandWildcards: 'expand_wildcards',
searchType: 'search_type',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
terminateAfter: 'terminate_after',
suggestField: 'suggest_field',
suggestMode: 'suggest_mode',

View File

@ -19,7 +19,9 @@ function buildBulk (opts) {
'type',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pipeline',
'pretty',
'human',
@ -31,7 +33,9 @@ function buildBulk (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -27,7 +27,7 @@ function buildClearScroll (opts) {
/**
* Perform a clear_scroll request
* Explicitly clears the search context for a scroll.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#_clear_scroll_api
* https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html
*/
return function clearScroll (params, options, callback) {
options = options || {}

View File

@ -33,7 +33,9 @@ function buildDeleteByQuery (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'version',
@ -62,7 +64,9 @@ function buildDeleteByQuery (opts) {
searchTimeout: 'search_timeout',
maxDocs: 'max_docs',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
terminateAfter: 'terminate_after',
requestCache: 'request_cache',
waitForActiveShards: 'wait_for_active_shards',

View File

@ -19,7 +19,9 @@ function buildExists (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
@ -32,7 +34,9 @@ function buildExists (opts) {
const snakeCase = {
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'

View File

@ -18,7 +18,9 @@ function buildExistsSource (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
@ -30,7 +32,9 @@ function buildExistsSource (opts) {
const snakeCase = {
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'

View File

@ -23,7 +23,9 @@ function buildExplain (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pretty',
'human',
'error_trace',
@ -36,7 +38,9 @@ function buildExplain (opts) {
defaultOperator: 'default_operator',
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -19,7 +19,9 @@ function buildGet (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
@ -32,7 +34,9 @@ function buildGet (opts) {
const snakeCase = {
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'

View File

@ -18,7 +18,9 @@ function buildGetSource (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'version',
'version_type',
'pretty',
@ -30,7 +32,9 @@ function buildGetSource (opts) {
const snakeCase = {
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'

View File

@ -36,7 +36,7 @@ function buildIndicesAddBlock (opts) {
/**
* Perform a indices.add_block request
* Adds a block to an index.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html
* https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html
*/
return function indicesAddBlock (params, options, callback) {
options = options || {}

View File

@ -12,21 +12,16 @@ function buildIndicesCreateDataStream (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a indices.create_data_stream request
* Creates or updates a data stream
* Creates a data stream
* https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
*/
return function indicesCreateDataStream (params, options, callback) {

View File

@ -0,0 +1,77 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildIndicesDataStreamsStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a indices.data_streams_stats request
* Provides statistics on operations happening in a data stream.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
*/
return function indicesDataStreamsStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
return handleError(err, callback)
}
var warnings = []
var { method, body, name, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((name) != null) {
if (method == null) method = 'GET'
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) + '/' + '_stats'
} else {
if (method == null) method = 'GET'
path = '/' + '_data_stream' + '/' + '_stats'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildIndicesDataStreamsStats

View File

@ -12,16 +12,11 @@ function buildIndicesDeleteDataStream (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**

View File

@ -12,16 +12,11 @@ function buildIndicesGetDataStream (opts) {
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**

View File

@ -18,6 +18,7 @@ function buildIndicesPutMapping (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'write_index_only',
'pretty',
'human',
'error_trace',
@ -31,6 +32,7 @@ function buildIndicesPutMapping (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
writeIndexOnly: 'write_index_only',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -29,7 +29,7 @@ function buildIndicesResolveIndex (opts) {
/**
* Perform a indices.resolve_index request
* Returns information about any matching indices, aliases, and data streams
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index.html
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html
*/
return function indicesResolveIndex (params, options, callback) {
options = options || {}

View File

@ -19,7 +19,9 @@ function buildMget (opts) {
'routing',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'pretty',
'human',
'error_trace',
@ -30,7 +32,9 @@ function buildMget (opts) {
const snakeCase = {
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -35,7 +35,9 @@ function buildSearch (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'suggest_field',
@ -73,7 +75,9 @@ function buildSearch (opts) {
expandWildcards: 'expand_wildcards',
searchType: 'search_type',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
terminateAfter: 'terminate_after',
suggestField: 'suggest_field',
suggestMode: 'suggest_mode',

View File

@ -15,7 +15,9 @@ function buildUpdate (opts) {
'wait_for_active_shards',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'lang',
'refresh',
'retry_on_conflict',
@ -33,7 +35,9 @@ function buildUpdate (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
retryOnConflict: 'retry_on_conflict',
ifSeqNo: 'if_seq_no',
ifPrimaryTerm: 'if_primary_term',

View File

@ -34,7 +34,9 @@ function buildUpdateByQuery (opts) {
'sort',
'_source',
'_source_excludes',
'_source_exclude',
'_source_includes',
'_source_include',
'terminate_after',
'stats',
'version',
@ -64,7 +66,9 @@ function buildUpdateByQuery (opts) {
searchTimeout: 'search_timeout',
maxDocs: 'max_docs',
_sourceExcludes: '_source_excludes',
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
terminateAfter: 'terminate_after',
versionType: 'version_type',
requestCache: 'request_cache',

View File

@ -215,6 +215,8 @@ function ESAPI (opts) {
create: lazyLoad('indices.create', opts),
create_data_stream: lazyLoad('indices.create_data_stream', opts),
createDataStream: lazyLoad('indices.create_data_stream', opts),
data_streams_stats: lazyLoad('indices.data_streams_stats', opts),
dataStreamsStats: lazyLoad('indices.data_streams_stats', opts),
delete: lazyLoad('indices.delete', opts),
delete_alias: lazyLoad('indices.delete_alias', opts),
deleteAlias: lazyLoad('indices.delete_alias', opts),

21
api/kibana.d.ts vendored
View File

@ -119,7 +119,7 @@ interface KibanaClient {
allocationExplain<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterAllocationExplain<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterDeleteComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteVotingConfigExclusions<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterDeleteVotingConfigExclusions, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsComponentTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterGetComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getSettings<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterGetSettings, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
health<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterHealth, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@ -155,8 +155,8 @@ interface KibanaClient {
get<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlGet, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.EqlSearch<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
}
exists<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsSource<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsSource<TResponse = boolean, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
explain<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Explain<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
fieldCaps<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.FieldCaps<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.Get, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@ -187,17 +187,18 @@ interface KibanaClient {
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesClone<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
close<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesClose, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
createDataStream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
createDataStream<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
dataStreamsStats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteAlias<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDeleteAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteDataStream<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDeleteDataStream, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteIndexTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDeleteIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDeleteTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsAlias<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsIndexTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsType<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsAlias<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsIndexTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsType<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
flush<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFlush, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
flushSynced<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFlushSynced, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
forcemerge<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesForcemerge, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@ -330,7 +331,7 @@ interface KibanaClient {
stats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
usage<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesUsage, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
}
ping<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.Ping, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
ping<TResponse = boolean, TContext = Context>(params?: RequestParams.Ping, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
putScript<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.PutScript<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
rankEval<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.RankEval<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
reindex<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Reindex<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

View File

@ -6,7 +6,6 @@ import { RequestBody, RequestNDBody } from '../lib/Transport'
export interface Generic {
method?: string;
ignore?: number | number[];
filter_path?: string | string[];
pretty?: boolean;
human?: boolean;
@ -17,8 +16,10 @@ export interface Generic {
export interface Bulk<T = RequestNDBody> extends Generic {
index?: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
wait_for_active_shards?: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
routing?: string;
timeout?: string;
_source?: string | string[];
@ -388,7 +389,7 @@ export interface Create<T = RequestBody> extends Generic {
index: string;
type?: string;
wait_for_active_shards?: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
routing?: string;
timeout?: string;
version?: number;
@ -419,7 +420,7 @@ export interface Delete extends Generic {
index: string;
type?: string;
wait_for_active_shards?: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
routing?: string;
timeout?: string;
if_seq_no?: number;
@ -431,6 +432,8 @@ export interface Delete extends Generic {
export interface DeleteByQuery<T = RequestBody> extends Generic {
index: string | string[];
type?: string | string[];
_source_exclude?: string | string[];
_source_include?: string | string[];
analyzer?: string;
analyze_wildcard?: boolean;
default_operator?: 'AND' | 'OR';
@ -482,6 +485,8 @@ export interface Exists extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
stored_fields?: string | string[];
preference?: string;
realtime?: boolean;
@ -498,6 +503,8 @@ export interface ExistsSource extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
preference?: string;
realtime?: boolean;
refresh?: boolean;
@ -513,6 +520,8 @@ export interface Explain<T = RequestBody> extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
analyze_wildcard?: boolean;
analyzer?: string;
default_operator?: 'AND' | 'OR';
@ -542,6 +551,8 @@ export interface Get extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
stored_fields?: string | string[];
preference?: string;
realtime?: boolean;
@ -569,6 +580,8 @@ export interface GetSource extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
preference?: string;
realtime?: boolean;
refresh?: boolean;
@ -586,7 +599,7 @@ export interface Index<T = RequestBody> extends Generic {
type?: string;
wait_for_active_shards?: string;
op_type?: 'index' | 'create';
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
routing?: string;
timeout?: string;
version?: number;
@ -651,11 +664,6 @@ export interface IndicesCreate<T = RequestBody> extends Generic {
body?: T;
}
export interface IndicesCreateDataStream<T = RequestBody> extends Generic {
name: string;
body?: T;
}
export interface IndicesDelete extends Generic {
index: string | string[];
timeout?: string;
@ -672,10 +680,6 @@ export interface IndicesDeleteAlias extends Generic {
master_timeout?: string;
}
export interface IndicesDeleteDataStream extends Generic {
name: string | string[];
}
export interface IndicesDeleteIndexTemplate extends Generic {
name: string;
timeout?: string;
@ -777,10 +781,6 @@ export interface IndicesGetAlias extends Generic {
local?: boolean;
}
export interface IndicesGetDataStream extends Generic {
name?: string | string[];
}
export interface IndicesGetFieldMapping extends Generic {
fields: string | string[];
index?: string | string[];
@ -873,6 +873,7 @@ export interface IndicesPutMapping<T = RequestBody> extends Generic {
ignore_unavailable?: boolean;
allow_no_indices?: boolean;
expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all';
write_index_only?: boolean;
body: T;
}
@ -1059,6 +1060,8 @@ export interface IngestSimulate<T = RequestBody> extends Generic {
export interface Mget<T = RequestBody> extends Generic {
index?: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
stored_fields?: string | string[];
preference?: string;
realtime?: boolean;
@ -1211,6 +1214,8 @@ export interface Scroll<T = RequestBody> extends Generic {
export interface Search<T = RequestBody> extends Generic {
index?: string | string[];
type?: string | string[];
_source_exclude?: string | string[];
_source_include?: string | string[];
analyzer?: string;
analyze_wildcard?: boolean;
ccs_minimize_roundtrips?: boolean;
@ -1400,12 +1405,14 @@ export interface Update<T = RequestBody> extends Generic {
id: string;
index: string;
type?: string;
_source_exclude?: string | string[];
_source_include?: string | string[];
wait_for_active_shards?: string;
_source?: string | string[];
_source_excludes?: string | string[];
_source_includes?: string | string[];
lang?: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
retry_on_conflict?: number;
routing?: string;
timeout?: string;
@ -1417,6 +1424,8 @@ export interface Update<T = RequestBody> extends Generic {
export interface UpdateByQuery<T = RequestBody> extends Generic {
index: string | string[];
type?: string | string[];
_source_exclude?: string | string[];
_source_include?: string | string[];
analyzer?: string;
analyze_wildcard?: boolean;
default_operator?: 'AND' | 'OR';
@ -1473,6 +1482,8 @@ export interface AsyncSearchGet extends Generic {
export interface AsyncSearchSubmit<T = RequestBody> extends Generic {
index?: string | string[];
_source_exclude?: string | string[];
_source_include?: string | string[];
wait_for_completion_timeout?: string;
keep_on_completion?: boolean;
keep_alive?: string;
@ -1739,6 +1750,18 @@ export interface IlmStart extends Generic {
export interface IlmStop extends Generic {
}
export interface IndicesCreateDataStream extends Generic {
name: string;
}
export interface IndicesDataStreamsStats extends Generic {
name?: string | string[];
}
export interface IndicesDeleteDataStream extends Generic {
name: string | string[];
}
export interface IndicesFreeze extends Generic {
index: string;
timeout?: string;
@ -1749,6 +1772,10 @@ export interface IndicesFreeze extends Generic {
wait_for_active_shards?: string;
}
export interface IndicesGetDataStream extends Generic {
name?: string | string[];
}
export interface IndicesReloadSearchAnalyzers extends Generic {
index: string | string[];
ignore_unavailable?: boolean;
@ -2276,7 +2303,7 @@ export interface SecurityAuthenticate extends Generic {
export interface SecurityChangePassword<T = RequestBody> extends Generic {
username?: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}
@ -2294,39 +2321,39 @@ export interface SecurityClearCachedRoles extends Generic {
}
export interface SecurityCreateApiKey<T = RequestBody> extends Generic {
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}
export interface SecurityDeletePrivileges extends Generic {
application: string;
name: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityDeleteRole extends Generic {
name: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityDeleteRoleMapping extends Generic {
name: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityDeleteUser extends Generic {
username: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityDisableUser extends Generic {
username: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityEnableUser extends Generic {
username: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
}
export interface SecurityGetApiKey extends Generic {
@ -2378,25 +2405,25 @@ export interface SecurityInvalidateToken<T = RequestBody> extends Generic {
}
export interface SecurityPutPrivileges<T = RequestBody> extends Generic {
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}
export interface SecurityPutRole<T = RequestBody> extends Generic {
name: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}
export interface SecurityPutRoleMapping<T = RequestBody> extends Generic {
name: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}
export interface SecurityPutUser<T = RequestBody> extends Generic {
username: string;
refresh?: 'true' | 'false' | 'wait_for';
refresh?: 'wait_for' | boolean;
body: T;
}

View File

@ -1056,7 +1056,7 @@ client.clearScroll({
body: object
})
----
link:{ref}/search-request-body.html#_clear_scroll_api[Documentation] +
link:{ref}/clear-scroll-api.html[Documentation] +
[cols=2*]
|===
|`scroll_id` or `scrollId`
@ -2473,7 +2473,7 @@ client.indices.addBlock({
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all'
})
----
link:{ref}/index-modules-blocks.html[Documentation] +
[cols=2*]
|===
|`index`
@ -2678,26 +2678,6 @@ link:{ref}/indices-create-index.html[Documentation] +
|===
=== indices.createDataStream
*Stability:* experimental
[source,ts]
----
client.indices.createDataStream({
name: string,
body: object
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string` - The name of the data stream
|`body`
|`object` - The data stream definition
|===
=== indices.delete
[source,ts]
@ -2763,22 +2743,6 @@ link:{ref}/indices-aliases.html[Documentation] +
|===
=== indices.deleteDataStream
*Stability:* experimental
[source,ts]
----
client.indices.deleteDataStream({
name: string | string[]
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string \| string[]` - A comma-separated list of data streams to delete; use `*` to delete all data streams
|===
=== indices.deleteIndexTemplate
*Stability:* experimental
[source,ts]
@ -3191,22 +3155,6 @@ _Default:_ `all`
|===
=== indices.getDataStream
*Stability:* experimental
[source,ts]
----
client.indices.getDataStream({
name: string | string[]
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string \| string[]` - A comma-separated list of data streams to get; use `*` to get all data streams
|===
=== indices.getFieldMapping
[source,ts]
@ -3563,6 +3511,7 @@ client.indices.putMapping({
ignore_unavailable: boolean,
allow_no_indices: boolean,
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all',
write_index_only: boolean,
body: object
})
----
@ -3596,6 +3545,9 @@ WARNING: This parameter has been deprecated.
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. +
_Default:_ `open`
|`write_index_only` or `writeIndexOnly`
|`boolean` - When true, applies mappings only to the write index of an alias or data stream
|`body`
|`object` - The mapping definition
@ -3748,7 +3700,7 @@ client.indices.resolveIndex({
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all'
})
----
link:{ref}/indices-resolve-index-api.html[Documentation] +
[cols=2*]
|===
|`name`
@ -7102,6 +7054,54 @@ client.ilm.stop()
link:{ref}/ilm-stop.html[Documentation] +
=== indices.createDataStream
[source,ts]
----
client.indices.createDataStream({
name: string
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string` - The name of the data stream
|===
=== indices.dataStreamsStats
[source,ts]
----
client.indices.dataStreamsStats({
name: string | string[]
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string \| string[]` - A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams
|===
=== indices.deleteDataStream
[source,ts]
----
client.indices.deleteDataStream({
name: string | string[]
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string \| string[]` - A comma-separated list of data streams to delete; use `*` to delete all data streams
|===
=== indices.freeze
[source,ts]
@ -7143,6 +7143,22 @@ _Default:_ `closed`
|===
=== indices.getDataStream
[source,ts]
----
client.indices.getDataStream({
name: string | string[]
})
----
link:{ref}/data-streams.html[Documentation] +
[cols=2*]
|===
|`name`
|`string \| string[]` - A comma-separated list of data streams to get; use `*` to get all data streams
|===
=== indices.reloadSearchAnalyzers
[source,ts]

144
index.d.ts vendored
View File

@ -442,14 +442,14 @@ declare class Client {
deleteVotingConfigExclusions<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deleteVotingConfigExclusions<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterDeleteVotingConfigExclusions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deleteVotingConfigExclusions<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterDeleteVotingConfigExclusions, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_component_template<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsComponentTemplate<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = boolean, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_component_template<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = boolean, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_component_template<TResponse = boolean, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.ClusterExistsComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsComponentTemplate<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsComponentTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.ClusterExistsComponentTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_component_template<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ClusterGetComponentTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get_component_template<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_component_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ClusterGetComponentTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@ -663,18 +663,18 @@ declare class Client {
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.EqlSearch<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.EqlSearch<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
exists<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.Exists, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.Exists, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_source<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ExistsSource, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ExistsSource, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsSource<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ExistsSource, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.ExistsSource, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params: RequestParams.Exists, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params: RequestParams.Exists, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = boolean, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_source<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = boolean, TContext = Context>(params: RequestParams.ExistsSource, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_source<TResponse = boolean, TContext = Context>(params: RequestParams.ExistsSource, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = boolean, TContext = Context>(params?: RequestParams.ExistsSource, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsSource<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = boolean, TContext = Context>(params: RequestParams.ExistsSource, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsSource<TResponse = boolean, TContext = Context>(params: RequestParams.ExistsSource, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
explain<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Explain<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
explain<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
explain<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Explain<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@ -836,14 +836,22 @@ declare class Client {
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreate<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
create_data_stream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
createDataStream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
create_data_stream<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
create_data_stream<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesCreateDataStream, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
createDataStream<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
createDataStream<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesCreateDataStream, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
data_streams_stats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
data_streams_stats<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
data_streams_stats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
data_streams_stats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
dataStreamsStats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
dataStreamsStats<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
dataStreamsStats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
dataStreamsStats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
delete<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDelete, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@ -880,42 +888,42 @@ declare class Client {
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDeleteTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDeleteTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExists, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExists, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_alias<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsAlias, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsAlias, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsAlias<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsAlias, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsAlias, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_index_template<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsIndexTemplate<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_template<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsTemplate<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_type<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsType, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsType, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsType<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsType, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesExistsType, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExists, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExists, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_alias<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsAlias, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_alias<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsAlias, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsAlias, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsAlias<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsAlias, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsAlias<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsAlias, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_index_template<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_index_template<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsIndexTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsIndexTemplate<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsIndexTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsIndexTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_template<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_template<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsTemplate, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsTemplate<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsTemplate<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
exists_type<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
exists_type<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExistsType, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
existsType<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
existsType<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
flush<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFlush, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
flush<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
flush<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFlush, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@ -1761,10 +1769,10 @@ declare class Client {
usage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesUsage, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
usage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesUsage, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
ping<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.Ping, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
ping<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
ping<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.Ping, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
ping<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.Ping, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
ping<TResponse = boolean, TContext = Context>(params?: RequestParams.Ping, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
ping<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
ping<TResponse = boolean, TContext = Context>(params: RequestParams.Ping, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
ping<TResponse = boolean, TContext = Context>(params: RequestParams.Ping, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
put_script<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.PutScript<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
put_script<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
put_script<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.PutScript<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback

2
lib/Transport.d.ts vendored
View File

@ -138,7 +138,7 @@ export default class Transport {
_nextSniff: number;
_isSniffing: boolean;
constructor(opts: TransportOptions);
request(params: TransportRequestParams, options?: TransportRequestOptions): Promise<ApiResponse>;
request(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse>;
request(params: TransportRequestParams, options?: TransportRequestOptions, callback?: (err: ApiError, result: ApiResponse) => void): TransportRequestCallback;
getConnection(opts: TransportGetConnectionOptions): Connection | null;
sniff(opts?: TransportSniffOptions, callback?: (...args: any[]) => void): void;

View File

@ -11,7 +11,7 @@
"./": "./"
},
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
"version": "7.7.1",
"version": "7.9.0",
"keywords": [
"elasticsearch",
"elastic",

View File

@ -35,8 +35,10 @@ function genFactory (folder, paths) {
.split('.')
.reverse()
.reduce((acc, val) => {
const body = hasBody(paths, file.slice(0, -3))
const methods = acc === null ? buildMethodDefinition({ kibana: false }, val, name, body) : null
const spec = readSpec(paths, file.slice(0, -3))
const isHead = isHeadMethod(spec, file.slice(0, -3))
const body = hasBody(spec, file.slice(0, -3))
const methods = acc === null ? buildMethodDefinition({ kibana: false }, val, name, body, isHead) : null
const obj = {}
if (methods) {
for (const m of methods) {
@ -65,8 +67,10 @@ function genFactory (folder, paths) {
.split('.')
.reverse()
.reduce((acc, val) => {
const body = hasBody(paths, file.slice(0, -3))
const methods = acc === null ? buildMethodDefinition({ kibana: true }, val, name, body) : null
const spec = readSpec(paths, file.slice(0, -3))
const isHead = isHeadMethod(spec, file.slice(0, -3))
const body = hasBody(spec, file.slice(0, -3))
const methods = acc === null ? buildMethodDefinition({ kibana: true }, val, name, body, isHead) : null
const obj = {}
if (methods) {
for (const m of methods) {
@ -216,73 +220,86 @@ function toPascalCase (str) {
return str[0].toUpperCase() + str.slice(1)
}
function buildMethodDefinition (opts, api, name, hasBody) {
function buildMethodDefinition (opts, api, name, hasBody, isHead) {
const Name = toPascalCase(name)
const bodyType = ndjsonApiKey.includes(Name) ? 'RequestNDBody' : 'RequestBody'
const responseType = isHead ? 'boolean' : 'Record<string, any>'
const defaultBodyType = ndjsonApiKey.includes(Name) ? 'Record<string, any>[]' : 'Record<string, any>'
if (opts.kibana) {
if (hasBody) {
return [
{ key: `${camelify(api)}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` }
{ key: `${camelify(api)}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` }
]
} else {
return [
{ key: `${camelify(api)}<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` }
{ key: `${camelify(api)}<TResponse = ${responseType}, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` }
]
}
}
if (hasBody) {
let methods = [
{ key: `${api}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${api}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
{ key: `${api}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${api}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
]
if (isSnakeCased(api)) {
methods = methods.concat([
{ key: `${camelify(api)}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
{ key: `${camelify(api)}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params?: RequestParams.${Name}<TRequestBody>, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TRequestBody extends ${bodyType} = ${defaultBodyType}, TContext = Context>(params: RequestParams.${Name}<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
])
}
return methods
} else {
let methods = [
{ key: `${api}<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${api}<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.${Name}, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.${Name}, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
{ key: `${api}<TResponse = ${responseType}, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${api}<TResponse = ${responseType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = ${responseType}, TContext = Context>(params: RequestParams.${Name}, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${api}<TResponse = ${responseType}, TContext = Context>(params: RequestParams.${Name}, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
]
if (isSnakeCased(api)) {
methods = methods.concat([
{ key: `${camelify(api)}<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.${Name}, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.${Name}, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
{ key: `${camelify(api)}<TResponse = ${responseType}, TContext = Context>(params?: RequestParams.${Name}, options?: TransportRequestOptions)`, val: `TransportRequestPromise<ApiResponse<TResponse, TContext>>` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TContext = Context>(callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TContext = Context>(params: RequestParams.${Name}, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` },
{ key: `${camelify(api)}<TResponse = ${responseType}, TContext = Context>(params: RequestParams.${Name}, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>)`, val: `TransportRequestCallback` }
])
}
return methods
}
}
function hasBody (paths, file) {
const spec = readSpec()
return !!spec[file].body
function hasBody (spec, api) {
return !!spec[api].body
}
function readSpec () {
try {
return require(join(paths[0], file))
} catch (err) {}
try {
return require(join(paths[1], file))
} catch (err) {}
throw new Error(`Cannot read spec file ${file}`)
function isHeadMethod (spec, api) {
const { paths } = spec[api].url
const methods = []
for (const path of paths) {
for (const method of path.methods) {
if (!methods.includes(method)) {
methods.push(method)
}
}
}
return methods.length === 1 && methods[0] === 'HEAD'
}
function readSpec (paths, file) {
try {
return require(join(paths[0], file))
} catch (err) {}
try {
return require(join(paths[1], file))
} catch (err) {}
throw new Error(`Cannot read spec file ${file}`)
}
module.exports = genFactory

View File

@ -26,7 +26,6 @@ import { RequestBody, RequestNDBody } from '../lib/Transport'
export interface Generic {
method?: string;
ignore?: number | number[];
filter_path?: string | string[];
pretty?: boolean;
human?: boolean;
@ -118,7 +117,31 @@ export interface ${toPascalCase(name)}${body ? `<T = ${bodyGeneric}>` : ''} exte
case 'timeout':
return 'string'
case 'enum':
return options.map(k => `'${k}'`).join(' | ')
// the following code changes 'true' | 'false' to boolean
let foundTrue = false
let foundFalse = false
options = options
.map(k => {
if (k === 'true') {
foundTrue = true
return true
} else if (k === 'false') {
foundFalse = true
return false
} else {
return `'${k}'`
}
})
.filter(k => {
if (foundTrue && foundFalse && (k === true || k === false)) {
return false
}
return true
})
if (foundTrue && foundFalse) {
options.push('boolean')
}
return options.join(' | ')
case 'int':
case 'double':
case 'long':

View File

@ -671,6 +671,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
context: 'hello world'

View File

@ -14,6 +14,7 @@ import {
TransportRequestParams,
TransportRequestOptions,
TransportRequestCallback,
TransportRequestPromise,
RequestEvent,
ApiError,
RequestBody,
@ -152,7 +153,7 @@ transport.request({
})
const promise = transport.request(params, options)
expectType<Promise<ApiResponse>>(promise)
expectType<TransportRequestPromise<ApiResponse>>(promise)
promise.then(result => expectType<ApiResponse>(result))
expectType<ApiResponse>(await promise)