API generation
This commit is contained in:
@ -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'
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
|
||||
86
api/api/indices.data_streams_stats.js
Normal file
86
api/api/indices.data_streams_stats.js
Normal file
@ -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
|
||||
@ -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'
|
||||
}
|
||||
|
||||
@ -14,7 +14,8 @@ function buildMlGetDataFrameAnalyticsStats (opts) {
|
||||
const acceptedQuerystring = [
|
||||
'allow_no_match',
|
||||
'from',
|
||||
'size'
|
||||
'size',
|
||||
'verbose'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
@ -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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user