API generation

This commit is contained in:
delvedor
2019-03-13 16:09:29 +01:00
parent 5030efd2d0
commit 51ef62b4f1
255 changed files with 3374 additions and 1674 deletions

View File

@ -35,6 +35,7 @@ function buildBulk (opts) {
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {string} type - Default document type for items which don't provide one
* @param {list} fields - Default comma-separated list of fields to return in the response for updates, can be overridden on each sub-request
* @param {list} _source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
* @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
* @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
@ -48,6 +49,7 @@ function buildBulk (opts) {
'routing',
'timeout',
'type',
'fields',
'_source',
'_source_excludes',
'_source_includes',
@ -79,6 +81,15 @@ function buildBulk (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
bulk(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['body'] == null) {
return callback(

View File

@ -71,6 +71,15 @@ function buildCatAliases (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catAliases(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildCatAllocation (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catAllocation(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -71,6 +71,15 @@ function buildCatCount (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catCount(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -75,6 +75,15 @@ function buildCatFielddata (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catFielddata(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -72,6 +72,15 @@ function buildCatHealth (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catHealth(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -59,6 +59,15 @@ function buildCatHelp (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catHelp(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -77,6 +77,15 @@ function buildCatIndices (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catIndices(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildCatMaster (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catMaster(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildCatNodeattrs (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catNodeattrs(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildCatNodes (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catNodes(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildCatPendingTasks (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catPendingTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildCatPlugins (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catPlugins(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -71,6 +71,15 @@ function buildCatRecovery (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catRecovery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildCatRepositories (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catRepositories(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -68,6 +68,15 @@ function buildCatSegments (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catSegments(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildCatShards (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catShards(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -72,6 +72,15 @@ function buildCatSnapshots (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catSnapshots(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -75,6 +75,15 @@ function buildCatTasks (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -71,6 +71,15 @@ function buildCatTemplates (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catTemplates(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildCatThreadPool (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catThreadPool(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -51,6 +51,15 @@ function buildCcrDeleteAutoFollowPattern (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrDeleteAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -29,16 +29,15 @@ function buildCcrFollow (opts) {
* Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request
*
* @param {string} index - The name of the follower index
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {object} body - The name of the leader index and other optional ccr related parameters
*/
const acceptedQuerystring = [
'wait_for_active_shards'
]
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards'
}
return function ccrFollow (params, options, callback) {
@ -53,6 +52,15 @@ function buildCcrFollow (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -1,117 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildCcrFollowInfo (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request
*
* @param {list} index - A comma-separated list of index patterns; use `_all` to perform the operation on all indices
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrFollowInfo (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') {
return callback(
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
result
)
}
var warnings = null
var { method, body, index } = params
var querystring = semicopy(params, ['method', 'body', 'index'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'info'
// build request object
const request = {
method,
path,
body: null,
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
compression: options.compression || false,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildCcrFollowInfo

View File

@ -51,6 +51,15 @@ function buildCcrFollowStats (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrFollowStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -51,6 +51,15 @@ function buildCcrGetAutoFollowPattern (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrGetAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -51,6 +51,15 @@ function buildCcrPauseFollow (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrPauseFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -52,6 +52,15 @@ function buildCcrPutAutoFollowPattern (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrPutAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -52,6 +52,15 @@ function buildCcrResumeFollow (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrResumeFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -50,6 +50,15 @@ function buildCcrStats (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -51,6 +51,15 @@ function buildCcrUnfollow (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrUnfollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -57,6 +57,15 @@ function buildClearScroll (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clearScroll(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -62,6 +62,15 @@ function buildClusterAllocationExplain (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterAllocationExplain(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -66,6 +66,15 @@ function buildClusterGetSettings (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterGetSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -83,6 +83,15 @@ function buildClusterHealth (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterHealth(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -60,6 +60,15 @@ function buildClusterPendingTasks (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterPendingTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -64,6 +64,15 @@ function buildClusterPutSettings (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterPutSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['body'] == null) {
return callback(

View File

@ -55,6 +55,15 @@ function buildClusterRemoteInfo (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterRemoteInfo(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -71,6 +71,15 @@ function buildClusterReroute (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterReroute(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -80,6 +80,15 @@ function buildClusterState (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterState(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -61,6 +61,15 @@ function buildClusterStats (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -94,6 +94,15 @@ function buildCount (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
count(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required url components
if (params['type'] != null && (params['index'] == null)) {
return callback(

View File

@ -77,6 +77,15 @@ function buildCreate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
create(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -90,6 +99,12 @@ function buildCreate (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
@ -120,11 +135,7 @@ function buildCreate (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
// build request object
const request = {

View File

@ -80,6 +80,15 @@ function buildDelete (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
_delete(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -93,6 +102,12 @@ function buildDelete (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -101,7 +116,12 @@ function buildDelete (opts) {
}
// check required url components
if (params['id'] != null && (params['index'] == null)) {
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: type, index'),
result
)
} else if (params['type'] != null && (params['index'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: index'),
result
@ -131,11 +151,7 @@ function buildDelete (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
// build request object
const request = {

View File

@ -137,6 +137,15 @@ function buildDeleteByQuery (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteByQuery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -59,6 +59,15 @@ function buildDeleteByQueryRethrottle (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteByQueryRethrottle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['task_id'] == null && params['taskId'] == null) {
return callback(

View File

@ -61,6 +61,15 @@ function buildDeleteScript (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteScript(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(

View File

@ -84,6 +84,15 @@ function buildExists (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
exists(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -97,6 +106,12 @@ function buildExists (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -127,11 +142,7 @@ function buildExists (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
// build request object
const request = {

View File

@ -30,7 +30,7 @@ function buildExistsSource (opts) {
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
* @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types
* @param {string} parent - The ID of the parent document
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
@ -81,6 +81,15 @@ function buildExistsSource (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
existsSource(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -94,6 +103,12 @@ function buildExistsSource (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -137,11 +152,7 @@ function buildExistsSource (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
// build request object
const request = {

View File

@ -90,6 +90,15 @@ function buildExplain (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
explain(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -103,6 +112,12 @@ function buildExplain (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
@ -127,11 +142,7 @@ function buildExplain (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
// build request object
const request = {

View File

@ -33,6 +33,7 @@ function buildFieldCaps (opts) {
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {object} body - Field json objects containing an array of field names
*/
const acceptedQuerystring = [
@ -67,12 +68,13 @@ function buildFieldCaps (opts) {
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
fieldCaps(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
@ -108,7 +110,7 @@ function buildFieldCaps (opts) {
const request = {
method,
path,
body: '',
body: body || '',
querystring
}

View File

@ -90,6 +90,15 @@ function buildGet (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
get(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -103,6 +112,12 @@ function buildGet (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -133,11 +148,7 @@ function buildGet (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
// build request object
const request = {

View File

@ -59,6 +59,15 @@ function buildGetScript (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
getScript(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(

View File

@ -30,7 +30,7 @@ function buildGetSource (opts) {
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
* @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types
* @param {string} parent - The ID of the parent document
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
@ -81,6 +81,15 @@ function buildGetSource (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
getSource(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -94,6 +103,12 @@ function buildGetSource (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -124,11 +139,7 @@ function buildGetSource (opts) {
var path = ''
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
// build request object
const request = {

View File

@ -51,6 +51,15 @@ function buildIlmDeleteLifecycle (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmDeleteLifecycle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -52,6 +52,15 @@ function buildIlmExplainLifecycle (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmExplainLifecycle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -51,6 +51,15 @@ function buildIlmGetLifecycle (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmGetLifecycle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -50,6 +50,15 @@ function buildIlmGetStatus (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmGetStatus(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -52,6 +52,15 @@ function buildIlmMoveToStep (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmMoveToStep(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -52,6 +52,15 @@ function buildIlmPutLifecycle (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmPutLifecycle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -51,6 +51,15 @@ function buildIlmRemovePolicy (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmRemovePolicy(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -51,6 +51,15 @@ function buildIlmRetry (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmRetry(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -50,6 +50,15 @@ function buildIlmStart (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmStart(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -50,6 +50,15 @@ function buildIlmStop (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ilmStop(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -86,6 +86,15 @@ function buildIndex (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
_index(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(
@ -93,6 +102,12 @@ function buildIndex (opts) {
result
)
}
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
@ -101,7 +116,12 @@ function buildIndex (opts) {
}
// check required url components
if (params['id'] != null && (params['index'] == null)) {
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: type, index'),
result
)
} else if (params['type'] != null && (params['index'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: index'),
result
@ -133,12 +153,8 @@ function buildIndex (opts) {
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else if ((index) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc'
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
}
// build request object

View File

@ -59,6 +59,15 @@ function buildIndicesAnalyze (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesAnalyze(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(

View File

@ -29,6 +29,7 @@ function buildIndicesClearCache (opts) {
* Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request
*
* @param {list} index - A comma-separated list of index name to limit the operation
* @param {boolean} field_data - Clear field data. This is deprecated. Prefer `fielddata`.
* @param {boolean} fielddata - Clear field data
* @param {list} fields - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)
* @param {boolean} query - Clear query caches
@ -36,10 +37,12 @@ function buildIndicesClearCache (opts) {
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {list} index - A comma-separated list of index name to limit the operation
* @param {boolean} request_cache - Clear request cache
* @param {boolean} request - Clear request cache
*/
const acceptedQuerystring = [
'field_data',
'fielddata',
'fields',
'query',
@ -47,6 +50,7 @@ function buildIndicesClearCache (opts) {
'allow_no_indices',
'expand_wildcards',
'index',
'request_cache',
'request',
'pretty',
'human',
@ -56,9 +60,11 @@ function buildIndicesClearCache (opts) {
]
const snakeCase = {
fieldData: 'field_data',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
requestCache: 'request_cache',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -75,6 +81,15 @@ function buildIndicesClearCache (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesClearCache(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(
@ -96,7 +111,7 @@ function buildIndicesClearCache (opts) {
var querystring = semicopy(params, ['method', 'body', 'index'])
if (method == null) {
method = 'POST'
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore || null

View File

@ -70,6 +70,15 @@ function buildIndicesClose (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesClose(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -29,18 +29,18 @@ function buildIndicesCreate (opts) {
* Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request
*
* @param {string} index - The name of the index
* @param {boolean} include_type_name - Whether a type should be expected in the body of the mappings.
* @param {string} wait_for_active_shards - Set the number of active shards to wait for before the operation returns.
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The configuration for the index (`settings` and `mappings`)
*/
const acceptedQuerystring = [
'include_type_name',
'wait_for_active_shards',
'timeout',
'master_timeout',
'update_all_types',
'pretty',
'human',
'error_trace',
@ -49,9 +49,9 @@ function buildIndicesCreate (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
waitForActiveShards: 'wait_for_active_shards',
masterTimeout: 'master_timeout',
updateAllTypes: 'update_all_types',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -68,6 +68,15 @@ function buildIndicesCreate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesCreate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildIndicesDelete (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDelete(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -62,6 +62,15 @@ function buildIndicesDeleteAlias (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDeleteAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -61,6 +61,15 @@ function buildIndicesDeleteTemplate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDeleteTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildIndicesExists (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExists(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -68,6 +68,15 @@ function buildIndicesExistsAlias (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -64,6 +64,15 @@ function buildIndicesExistsTemplate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -68,6 +68,15 @@ function buildIndicesExistsType (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsType(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -70,6 +70,15 @@ function buildIndicesFlush (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesFlush(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -65,6 +65,15 @@ function buildIndicesFlushSynced (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesFlushSynced(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildIndicesForcemerge (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesForcemerge(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -66,6 +66,15 @@ function buildIndicesFreeze (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesFreeze(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -29,7 +29,6 @@ function buildIndicesGet (opts) {
* Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request
*
* @param {list} index - A comma-separated list of index names
* @param {boolean} include_type_name - Whether to add the type name to the response (default: false)
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {boolean} ignore_unavailable - Ignore unavailable indexes (default: false)
* @param {boolean} allow_no_indices - Ignore if a wildcard expression resolves to no concrete indices (default: false)
@ -40,7 +39,6 @@ function buildIndicesGet (opts) {
*/
const acceptedQuerystring = [
'include_type_name',
'local',
'ignore_unavailable',
'allow_no_indices',
@ -56,7 +54,6 @@ function buildIndicesGet (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
@ -79,6 +76,15 @@ function buildIndicesGet (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGet(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -68,6 +68,15 @@ function buildIndicesGetAlias (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -31,7 +31,6 @@ function buildIndicesGetFieldMapping (opts) {
* @param {list} index - A comma-separated list of index names
* @param {list} type - A comma-separated list of document types
* @param {list} fields - A comma-separated list of fields
* @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings.
* @param {boolean} include_defaults - Whether the default mapping values should be returned as well
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
@ -40,7 +39,6 @@ function buildIndicesGetFieldMapping (opts) {
*/
const acceptedQuerystring = [
'include_type_name',
'include_defaults',
'ignore_unavailable',
'allow_no_indices',
@ -54,7 +52,6 @@ function buildIndicesGetFieldMapping (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
includeDefaults: 'include_defaults',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
@ -75,6 +72,15 @@ function buildIndicesGetFieldMapping (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetFieldMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['fields'] == null) {
return callback(

View File

@ -30,7 +30,6 @@ function buildIndicesGetMapping (opts) {
*
* @param {list} index - A comma-separated list of index names
* @param {list} type - A comma-separated list of document types
* @param {boolean} include_type_name - Whether to add the type name to the response (default: false)
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
@ -39,7 +38,6 @@ function buildIndicesGetMapping (opts) {
*/
const acceptedQuerystring = [
'include_type_name',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
@ -53,7 +51,6 @@ function buildIndicesGetMapping (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
@ -74,6 +71,15 @@ function buildIndicesGetMapping (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -77,6 +77,15 @@ function buildIndicesGetSettings (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -29,14 +29,12 @@ function buildIndicesGetTemplate (opts) {
* Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
*
* @param {list} name - The comma separated names of the index templates
* @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings.
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
const acceptedQuerystring = [
'include_type_name',
'flat_settings',
'master_timeout',
'local',
@ -48,7 +46,6 @@ function buildIndicesGetTemplate (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
flatSettings: 'flat_settings',
masterTimeout: 'master_timeout',
errorTrace: 'error_trace',
@ -67,6 +64,15 @@ function buildIndicesGetTemplate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -65,6 +65,15 @@ function buildIndicesGetUpgrade (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetUpgrade(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -73,6 +73,15 @@ function buildIndicesOpen (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesOpen(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -63,6 +63,15 @@ function buildIndicesPutAlias (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -30,22 +30,22 @@ function buildIndicesPutMapping (opts) {
*
* @param {list} index - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.
* @param {string} type - The name of the document type
* @param {boolean} include_type_name - Whether a type should be expected in the body of the mappings.
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The mapping definition
*/
const acceptedQuerystring = [
'include_type_name',
'timeout',
'master_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'update_all_types',
'pretty',
'human',
'error_trace',
@ -54,11 +54,11 @@ function buildIndicesPutMapping (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
masterTimeout: 'master_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
updateAllTypes: 'update_all_types',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -75,7 +75,22 @@ function buildIndicesPutMapping (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['type'] == null) {
return callback(
new ConfigurationError('Missing required parameter: type'),
result
)
}
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
@ -116,12 +131,8 @@ function buildIndicesPutMapping (opts) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
}
// build request object

View File

@ -77,6 +77,15 @@ function buildIndicesPutSettings (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['body'] == null) {
return callback(

View File

@ -29,7 +29,6 @@ function buildIndicesPutTemplate (opts) {
* Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
*
* @param {string} name - The name of the template
* @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings.
* @param {number} order - The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)
* @param {boolean} create - Whether the index template should only be added if new or can also replace an existing one
* @param {time} timeout - Explicit operation timeout
@ -39,7 +38,6 @@ function buildIndicesPutTemplate (opts) {
*/
const acceptedQuerystring = [
'include_type_name',
'order',
'create',
'timeout',
@ -53,7 +51,6 @@ function buildIndicesPutTemplate (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
masterTimeout: 'master_timeout',
flatSettings: 'flat_settings',
errorTrace: 'error_trace',
@ -72,6 +69,15 @@ function buildIndicesPutTemplate (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['name'] == null) {
return callback(

View File

@ -61,6 +61,15 @@ function buildIndicesRecovery (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRecovery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -65,6 +65,15 @@ function buildIndicesRefresh (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRefresh(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -30,7 +30,6 @@ function buildIndicesRollover (opts) {
*
* @param {string} alias - The name of the alias to rollover
* @param {string} new_index - The name of the rollover index
* @param {boolean} include_type_name - Whether a type should be included in the body of the mappings.
* @param {time} timeout - Explicit operation timeout
* @param {boolean} dry_run - If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
* @param {time} master_timeout - Specify timeout for connection to master
@ -39,7 +38,6 @@ function buildIndicesRollover (opts) {
*/
const acceptedQuerystring = [
'include_type_name',
'timeout',
'dry_run',
'master_timeout',
@ -52,7 +50,6 @@ function buildIndicesRollover (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
dryRun: 'dry_run',
masterTimeout: 'master_timeout',
waitForActiveShards: 'wait_for_active_shards',
@ -72,6 +69,15 @@ function buildIndicesRollover (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRollover(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['alias'] == null) {
return callback(

View File

@ -67,6 +67,15 @@ function buildIndicesSegments (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesSegments(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -67,6 +67,15 @@ function buildIndicesShardStores (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesShardStores(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

View File

@ -69,6 +69,15 @@ function buildIndicesShrink (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesShrink(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -69,6 +69,15 @@ function buildIndicesSplit (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesSplit(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(

View File

@ -74,6 +74,15 @@ function buildIndicesStats (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params.body != null) {
return callback(

Some files were not shown because too many files have changed in this diff Show More