diff --git a/api/api/bulk.js b/api/api/bulk.js index 361dd22b1..c97ee719f 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -21,6 +21,7 @@ function buildBulk (opts) { '_source_excludes', '_source_includes', 'pipeline', + 'require_alias', 'pretty', 'human', 'error_trace', @@ -32,6 +33,7 @@ function buildBulk (opts) { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', + requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/index.js b/api/api/index.js index 6136772b9..32421bcd6 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -22,6 +22,7 @@ function buildIndex (opts) { 'if_seq_no', 'if_primary_term', 'pipeline', + 'require_alias', 'pretty', 'human', 'error_trace', @@ -35,6 +36,7 @@ function buildIndex (opts) { versionType: 'version_type', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', + requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/api/indices.data_streams_stats.js b/api/api/indices.data_streams_stats.js new file mode 100644 index 000000000..53abb7fc7 --- /dev/null +++ b/api/api/indices.data_streams_stats.js @@ -0,0 +1,86 @@ +// 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 = [ + 'expand_wildcards', + 'forbid_closed_indices', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + expandWildcards: 'expand_wildcards', + forbidClosedIndices: 'forbid_closed_indices', + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + /** + * 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 diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 7335604cb..3fdef01e4 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -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' } diff --git a/api/api/ml.get_data_frame_analytics_stats.js b/api/api/ml.get_data_frame_analytics_stats.js index 82f4d71d5..73e224828 100644 --- a/api/api/ml.get_data_frame_analytics_stats.js +++ b/api/api/ml.get_data_frame_analytics_stats.js @@ -14,7 +14,8 @@ function buildMlGetDataFrameAnalyticsStats (opts) { const acceptedQuerystring = [ 'allow_no_match', 'from', - 'size' + 'size', + 'verbose' ] const snakeCase = { diff --git a/api/api/update.js b/api/api/update.js index e45c32c38..058e82bb7 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -23,6 +23,7 @@ function buildUpdate (opts) { 'timeout', 'if_seq_no', 'if_primary_term', + 'require_alias', 'pretty', 'human', 'error_trace', @@ -37,6 +38,7 @@ function buildUpdate (opts) { retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', + requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } diff --git a/api/index.js b/api/index.js index cba5c6f80..3b9c905e4 100644 --- a/api/index.js +++ b/api/index.js @@ -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), diff --git a/api/kibana.d.ts b/api/kibana.d.ts index 92dc72a20..88c2cbb1f 100644 --- a/api/kibana.d.ts +++ b/api/kibana.d.ts @@ -188,6 +188,7 @@ interface KibanaClient { close, TContext = Context>(params?: RequestParams.IndicesClose, options?: TransportRequestOptions): TransportRequestPromise> create, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.IndicesCreate, options?: TransportRequestOptions): TransportRequestPromise> createDataStream, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.IndicesCreateDataStream, options?: TransportRequestOptions): TransportRequestPromise> + dataStreamsStats, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise> delete, TContext = Context>(params?: RequestParams.IndicesDelete, options?: TransportRequestOptions): TransportRequestPromise> deleteAlias, TContext = Context>(params?: RequestParams.IndicesDeleteAlias, options?: TransportRequestOptions): TransportRequestPromise> deleteDataStream, TContext = Context>(params?: RequestParams.IndicesDeleteDataStream, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 4dff1b3dc..cbc78d033 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -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; @@ -18,13 +17,14 @@ export interface Bulk extends Generic { index?: string; type?: string; wait_for_active_shards?: string; - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; routing?: string; timeout?: string; _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; pipeline?: string; + require_alias?: boolean; body: T; } @@ -388,7 +388,7 @@ export interface Create 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 +419,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; @@ -586,7 +586,7 @@ export interface Index 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; @@ -594,6 +594,7 @@ export interface Index extends Generic { if_seq_no?: number; if_primary_term?: number; pipeline?: string; + require_alias?: boolean; body: T; } @@ -656,6 +657,12 @@ export interface IndicesCreateDataStream extends Generic { body?: T; } +export interface IndicesDataStreamsStats extends Generic { + name?: string | string[]; + expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; + forbid_closed_indices?: boolean; +} + export interface IndicesDelete extends Generic { index: string | string[]; timeout?: string; @@ -873,6 +880,7 @@ export interface IndicesPutMapping extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; + write_index_only?: boolean; body: T; } @@ -1405,12 +1413,13 @@ export interface Update extends Generic { _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; if_seq_no?: number; if_primary_term?: number; + require_alias?: boolean; body: T; } @@ -1964,6 +1973,7 @@ export interface MlGetDataFrameAnalyticsStats extends Generic { allow_no_match?: boolean; from?: number; size?: number; + verbose?: boolean; } export interface MlGetDatafeedStats extends Generic { @@ -2276,7 +2286,7 @@ export interface SecurityAuthenticate extends Generic { export interface SecurityChangePassword extends Generic { username?: string; - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; body: T; } @@ -2294,39 +2304,39 @@ export interface SecurityClearCachedRoles extends Generic { } export interface SecurityCreateApiKey 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 +2388,25 @@ export interface SecurityInvalidateToken extends Generic { } export interface SecurityPutPrivileges extends Generic { - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; body: T; } export interface SecurityPutRole extends Generic { name: string; - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; body: T; } export interface SecurityPutRoleMapping extends Generic { name: string; - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; body: T; } export interface SecurityPutUser extends Generic { username: string; - refresh?: 'true' | 'false' | 'wait_for'; + refresh?: 'wait_for' | boolean; body: T; } diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 87b6a6bff..42ee29e82 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -110,6 +110,7 @@ client.bulk({ _source_excludes: string | string[], _source_includes: string | string[], pipeline: string, + require_alias: boolean, body: object }) ---- @@ -147,6 +148,9 @@ link:{ref}/docs-bulk.html[Documentation] + |`pipeline` |`string` - The pipeline id to preprocess incoming documents with +|`require_alias` or `requireAlias` +|`boolean` - Sets require_alias for all incoming documents. Defaults to unset (false) + |`body` |`object` - The operation definition and data (action-data pairs), separated by newlines @@ -2407,6 +2411,7 @@ client.index({ if_seq_no: number, if_primary_term: number, pipeline: string, + require_alias: boolean, body: object }) ---- @@ -2454,6 +2459,9 @@ WARNING: This parameter has been deprecated. |`pipeline` |`string` - The pipeline id to preprocess incoming documents with +|`require_alias` or `requireAlias` +|`boolean` - When true, requires destination to be an alias. Default is false + |`body` |`object` - The document @@ -2698,6 +2706,32 @@ link:{ref}/data-streams.html[Documentation] + |=== +=== indices.dataStreamsStats +*Stability:* experimental +[source,ts] +---- +client.indices.dataStreamsStats({ + name: string | string[], + expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all', + forbid_closed_indices: boolean +}) +---- +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 + +|`expand_wildcards` or `expandWildcards` +|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. + +_Default:_ `open` + +|`forbid_closed_indices` or `forbidClosedIndices` +|`boolean` - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices + +_Default:_ `true` + +|=== + === indices.delete [source,ts] @@ -3563,6 +3597,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 +3631,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 @@ -5740,6 +5778,7 @@ client.update({ timeout: string, if_seq_no: number, if_primary_term: number, + require_alias: boolean, body: object }) ---- @@ -5791,6 +5830,9 @@ WARNING: This parameter has been deprecated. |`if_primary_term` or `ifPrimaryTerm` |`number` - only perform the update operation if the last operation that has changed the document has the specified primary term +|`require_alias` or `requireAlias` +|`boolean` - When true, requires destination is an alias. Default is false + |`body` |`object` - The request definition requires either `script` or partial `doc` @@ -7990,7 +8032,8 @@ client.ml.getDataFrameAnalyticsStats({ id: string, allow_no_match: boolean, from: number, - size: number + size: number, + verbose: boolean }) ---- link:{ref}/get-dfanalytics-stats.html[Documentation] + @@ -8010,6 +8053,9 @@ _Default:_ `true` |`number` - specifies a max number of analytics to get + _Default:_ `100` +|`verbose` +|`boolean` - whether the stats response should be verbose + |=== === ml.getDatafeedStats diff --git a/index.d.ts b/index.d.ts index b76003eb2..4f2673652 100644 --- a/index.d.ts +++ b/index.d.ts @@ -844,6 +844,14 @@ declare class Client { createDataStream, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback createDataStream, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.IndicesCreateDataStream, callback: callbackFn): TransportRequestCallback createDataStream, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.IndicesCreateDataStream, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + data_streams_stats, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise> + data_streams_stats, TContext = Context>(callback: callbackFn): TransportRequestCallback + data_streams_stats, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, callback: callbackFn): TransportRequestCallback + data_streams_stats, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + dataStreamsStats, TContext = Context>(params?: RequestParams.IndicesDataStreamsStats, options?: TransportRequestOptions): TransportRequestPromise> + dataStreamsStats, TContext = Context>(callback: callbackFn): TransportRequestCallback + dataStreamsStats, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, callback: callbackFn): TransportRequestCallback + dataStreamsStats, TContext = Context>(params: RequestParams.IndicesDataStreamsStats, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback delete, TContext = Context>(params?: RequestParams.IndicesDelete, options?: TransportRequestOptions): TransportRequestPromise> delete, TContext = Context>(callback: callbackFn): TransportRequestCallback delete, TContext = Context>(params: RequestParams.IndicesDelete, callback: callbackFn): TransportRequestCallback