API generation

This commit is contained in:
delvedor
2019-03-19 11:23:46 +01:00
parent 070dd239bb
commit b19f0d5fc7
256 changed files with 2094 additions and 18640 deletions

View File

@ -26,7 +26,7 @@ function buildBulk (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
* Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-bulk.html) request
*
* @param {string} index - Default index for items which don't provide one
* @param {string} type - Default document type for items which don't provide one
@ -35,9 +35,10 @@ 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
* @param {list} _source_exclude - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
* @param {list} _source_include - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
*/
@ -48,9 +49,10 @@ function buildBulk (opts) {
'routing',
'timeout',
'type',
'fields',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'pipeline',
'pretty',
'human',
@ -61,8 +63,8 @@ function buildBulk (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -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

@ -26,7 +26,7 @@ function buildCatAliases (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request
* Perform a [cat.aliases](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-alias.html) request
*
* @param {list} name - A comma-separated list of alias names to return
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatAllocation (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request
* Perform a [cat.allocation](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-allocation.html) request
*
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatCount (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request
* Perform a [cat.count](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-count.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatFielddata (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request
* Perform a [cat.fielddata](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-fielddata.html) request
*
* @param {list} fields - A comma-separated list of fields to return the fielddata size
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatHealth (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request
* Perform a [cat.health](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-health.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatHelp (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request
* Perform a [cat.help](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat.html) request
*
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
@ -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

@ -26,7 +26,7 @@ function buildCatIndices (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request
* Perform a [cat.indices](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-indices.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatMaster (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request
* Perform a [cat.master](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-master.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatNodeattrs (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request
* Perform a [cat.nodeattrs](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodeattrs.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatNodes (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request
* Perform a [cat.nodes](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodes.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} full_id - Return the full node ID instead of the shortened version (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatPendingTasks (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request
* Perform a [cat.pending_tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-pending-tasks.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatPlugins (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request
* Perform a [cat.plugins](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-plugins.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildCatRecovery (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request
* Perform a [cat.recovery](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-recovery.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatRepositories (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request
* Perform a [cat.repositories](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-repositories.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node
@ -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

@ -26,7 +26,7 @@ function buildCatSegments (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request
* Perform a [cat.segments](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-segments.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatShards (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request
* Perform a [cat.shards](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-shards.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatSnapshots (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request
* Perform a [cat.snapshots](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-snapshots.html) request
*
* @param {list} repository - Name of repository from which to fetch the snapshot information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -72,7 +72,22 @@ 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['repository'] == null) {
return callback(
new ConfigurationError('Missing required parameter: repository'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),

View File

@ -26,12 +26,13 @@ function buildCatTasks (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
* Perform a [cat.tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
* @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
* @param {boolean} detailed - Return detailed task information (default: false)
* @param {string} parent_node - Return tasks with specified parent node.
* @param {number} parent_task - Return tasks with specified parent task id. Set to -1 to return all.
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
@ -44,6 +45,7 @@ function buildCatTasks (opts) {
'node_id',
'actions',
'detailed',
'parent_node',
'parent_task',
'h',
'help',
@ -58,6 +60,7 @@ function buildCatTasks (opts) {
const snakeCase = {
nodeId: 'node_id',
parentNode: 'parent_node',
parentTask: 'parent_task',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -75,6 +78,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

@ -26,7 +26,7 @@ function buildCatTemplates (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request
* Perform a [cat.templates](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-templates.html) request
*
* @param {string} name - A pattern that returned template names must match
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -26,7 +26,7 @@ function buildCatThreadPool (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
* Perform a [cat.thread_pool](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-thread-pool.html) request
*
* @param {list} thread_pool_patterns - A comma-separated list of regular-expressions to filter the thread pools in the output
* @param {string} format - a short version of the Accept header, e.g. json, yaml
@ -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

@ -1,126 +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 buildCcrDeleteAutoFollowPattern (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request
*
* @param {string} name - The name of the auto follow pattern.
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrDeleteAutoFollowPattern (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['name'] == null) {
return callback(
new ConfigurationError('Missing required parameter: name'),
result
)
}
// 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, name } = params
var querystring = semicopy(params, ['method', 'body', 'name'])
if (method == null) {
method = 'DELETE'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrDeleteAutoFollowPattern

View File

@ -1,134 +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 buildCcrFollow (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = 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) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['index'] == null) {
return callback(
new ConfigurationError('Missing required parameter: index'),
result
)
}
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
result
)
}
// 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 = 'PUT'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'follow'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrFollow

View File

@ -1,118 +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,
querystring: options.querystring || 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

@ -1,118 +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 buildCcrFollowStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.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 ccrFollowStats (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' + '/' + 'stats'
// 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,
querystring: options.querystring || 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 = buildCcrFollowStats

View File

@ -1,122 +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 buildCcrGetAutoFollowPattern (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request
*
* @param {string} name - The name of the auto follow pattern.
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrGetAutoFollowPattern (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, name } = params
var querystring = semicopy(params, ['method', 'body', 'name'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
if ((name) != null) {
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
} else {
path = '/' + '_ccr' + '/' + 'auto_follow'
}
// 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,
querystring: options.querystring || 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 = buildCcrGetAutoFollowPattern

View File

@ -1,126 +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 buildCcrPauseFollow (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request
*
* @param {string} index - The name of the follower index that should pause following its leader index.
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrPauseFollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['index'] == null) {
return callback(
new ConfigurationError('Missing required parameter: index'),
result
)
}
// 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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'pause_follow'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrPauseFollow

View File

@ -1,133 +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 buildCcrPutAutoFollowPattern (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request
*
* @param {string} name - The name of the auto follow pattern.
* @param {object} body - The specification of the auto follow pattern
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrPutAutoFollowPattern (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['name'] == null) {
return callback(
new ConfigurationError('Missing required parameter: name'),
result
)
}
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
result
)
}
// 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, name } = params
var querystring = semicopy(params, ['method', 'body', 'name'])
if (method == null) {
method = 'PUT'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrPutAutoFollowPattern

View File

@ -1,127 +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 buildCcrResumeFollow (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request
*
* @param {string} index - The name of the follow index to resume following.
* @param {object} body - The name of the leader index and other optional ccr related parameters
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrResumeFollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['index'] == null) {
return callback(
new ConfigurationError('Missing required parameter: index'),
result
)
}
// 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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'resume_follow'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrResumeFollow

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 buildCcrStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request
*
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrStats (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 } = params
var querystring = semicopy(params, ['method', 'body'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ccr' + '/' + 'stats'
// 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,
querystring: options.querystring || 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 = buildCcrStats

View File

@ -1,126 +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 buildCcrUnfollow (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request
*
* @param {string} index - The name of the follower index that should be turned into a regular index.
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ccrUnfollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['index'] == null) {
return callback(
new ConfigurationError('Missing required parameter: index'),
result
)
}
// 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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'unfollow'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildCcrUnfollow

View File

@ -26,7 +26,7 @@ function buildClearScroll (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request
* Perform a [clear_scroll](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-request-scroll.html) request
*
* @param {list} scroll_id - A comma-separated list of scroll IDs to clear
* @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
@ -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

@ -26,7 +26,7 @@ function buildClusterAllocationExplain (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request
* Perform a [cluster.allocation_explain](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-allocation-explain.html) request
*
* @param {boolean} include_yes_decisions - Return 'YES' decisions in explanation (default: false)
* @param {boolean} include_disk_info - Return information about disk usage and shard sizes (default: false)
@ -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

@ -26,7 +26,7 @@ function buildClusterGetSettings (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
* Perform a [cluster.get_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-update-settings.html) request
*
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
@ -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

@ -26,7 +26,7 @@ function buildClusterHealth (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request
* Perform a [cluster.health](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-health.html) request
*
* @param {list} index - Limit the information returned to a specific index
* @param {enum} level - Specify the level of detail for returned information
@ -37,7 +37,6 @@ function buildClusterHealth (opts) {
* @param {string} wait_for_nodes - Wait until the specified number of nodes is available
* @param {enum} wait_for_events - Wait until all currently queued events with the given priority are processed
* @param {boolean} wait_for_no_relocating_shards - Whether to wait until there are no relocating shards in the cluster
* @param {boolean} wait_for_no_initializing_shards - Whether to wait until there are no initializing shards in the cluster
* @param {enum} wait_for_status - Wait until cluster is in a specific state
*/
@ -50,7 +49,6 @@ function buildClusterHealth (opts) {
'wait_for_nodes',
'wait_for_events',
'wait_for_no_relocating_shards',
'wait_for_no_initializing_shards',
'wait_for_status',
'pretty',
'human',
@ -65,7 +63,6 @@ function buildClusterHealth (opts) {
waitForNodes: 'wait_for_nodes',
waitForEvents: 'wait_for_events',
waitForNoRelocatingShards: 'wait_for_no_relocating_shards',
waitForNoInitializingShards: 'wait_for_no_initializing_shards',
waitForStatus: 'wait_for_status',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -83,6 +80,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

@ -26,7 +26,7 @@ function buildClusterPendingTasks (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request
* Perform a [cluster.pending_tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-pending.html) request
*
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Specify timeout for connection to master
@ -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

@ -26,7 +26,7 @@ function buildClusterPutSettings (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
* Perform a [cluster.put_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-update-settings.html) request
*
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
@ -64,12 +64,13 @@ function buildClusterPutSettings (opts) {
options = {}
}
// check required parameters
if (params['body'] == null) {
return callback(
new ConfigurationError('Missing required parameter: body'),
result
)
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterPutSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object

View File

@ -26,7 +26,7 @@ function buildClusterRemoteInfo (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request
* Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-remote-info.html) request
*
*/
@ -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

@ -26,7 +26,7 @@ function buildClusterReroute (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request
* Perform a [cluster.reroute](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-reroute.html) request
*
* @param {boolean} dry_run - Simulate the operation only and return the resulting state
* @param {boolean} explain - Return an explanation of why the commands can or cannot be executed
@ -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

@ -26,15 +26,13 @@ function buildClusterState (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request
* Perform a [cluster.state](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-state.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} metric - Limit the information returned to the specified metrics
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {number} wait_for_metadata_version - Wait for the metadata version to be equal or greater than the specified metadata version
* @param {time} wait_for_timeout - The maximum time to wait for wait_for_metadata_version before timing out
* @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.
@ -44,8 +42,6 @@ function buildClusterState (opts) {
'local',
'master_timeout',
'flat_settings',
'wait_for_metadata_version',
'wait_for_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
@ -59,8 +55,6 @@ function buildClusterState (opts) {
const snakeCase = {
masterTimeout: 'master_timeout',
flatSettings: 'flat_settings',
waitForMetadataVersion: 'wait_for_metadata_version',
waitForTimeout: 'wait_for_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
@ -80,6 +74,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

@ -26,7 +26,7 @@ function buildClusterStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request
* Perform a [cluster.stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-stats.html) request
*
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
* @param {boolean} flat_settings - Return settings in flat format (default: false)
@ -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

@ -26,12 +26,11 @@ function buildCount (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request
* Perform a [count](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-count.html) request
*
* @param {list} index - A comma-separated list of indices to restrict the results
* @param {list} type - A comma-separated list of types to restrict the results
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled
* @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 {number} min_score - Include only documents with a specific `_score` value in the result
@ -49,7 +48,6 @@ function buildCount (opts) {
const acceptedQuerystring = [
'ignore_unavailable',
'ignore_throttled',
'allow_no_indices',
'expand_wildcards',
'min_score',
@ -71,7 +69,6 @@ function buildCount (opts) {
const snakeCase = {
ignoreUnavailable: 'ignore_unavailable',
ignoreThrottled: 'ignore_throttled',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
minScore: 'min_score',
@ -94,6 +91,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

@ -22,39 +22,56 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildIndicesFreeze (opts) {
function buildCountPercolate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.freeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request
* Perform a [count_percolate](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-percolate.html) request
*
* @param {string} index - The name of the index to freeze
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
* @param {string} index - The index of the document being count percolated.
* @param {string} type - The type of the document being count percolated.
* @param {string} id - Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
* @param {list} routing - A comma-separated list of specific routing values
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
* @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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns.
* @param {string} percolate_index - The index to count percolate the document into. Defaults to index.
* @param {string} percolate_type - The type to count percolate document into. Defaults to type.
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
* @param {object} body - The count percolator request definition using the percolate DSL
*/
const acceptedQuerystring = [
'timeout',
'master_timeout',
'routing',
'preference',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'wait_for_active_shards'
'percolate_index',
'percolate_type',
'version',
'version_type',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
masterTimeout: 'master_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
waitForActiveShards: 'wait_for_active_shards'
percolateIndex: 'percolate_index',
percolateType: 'percolate_type',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function indicesFreeze (params, options, callback) {
return function countPercolate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -66,6 +83,15 @@ function buildIndicesFreeze (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
countPercolate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['index'] == null) {
return callback(
@ -73,9 +99,22 @@ function buildIndicesFreeze (opts) {
result
)
}
if (params.body != null) {
if (params['type'] == null) {
return callback(
new ConfigurationError('This API does not require a body'),
new ConfigurationError('Missing required parameter: type'),
result
)
}
// check required url components
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
)
}
@ -89,11 +128,11 @@ function buildIndicesFreeze (opts) {
}
var warnings = null
var { method, body, index } = params
var querystring = semicopy(params, ['method', 'body', 'index'])
var { method, body, index, type, id } = params
var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'id'])
if (method == null) {
method = 'POST'
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore || null
@ -103,13 +142,17 @@ function buildIndicesFreeze (opts) {
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_freeze'
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_percolate' + '/' + 'count'
} else {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_percolate' + '/' + 'count'
}
// build request object
const request = {
method,
path,
body: '',
body: body || '',
querystring
}
@ -144,4 +187,4 @@ function buildIndicesFreeze (opts) {
}
}
module.exports = buildIndicesFreeze
module.exports = buildCountPercolate

View File

@ -26,7 +26,7 @@ function buildCreate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request
* Perform a [create](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html) request
*
* @param {string} id - Document ID
* @param {string} index - The name of the index
@ -36,6 +36,8 @@ function buildCreate (opts) {
* @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {time} timestamp - Explicit timestamp for the document
* @param {time} ttl - Expiration time for the document
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
@ -48,6 +50,8 @@ function buildCreate (opts) {
'refresh',
'routing',
'timeout',
'timestamp',
'ttl',
'version',
'version_type',
'pipeline',
@ -77,6 +81,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 +103,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 +139,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

@ -26,7 +26,7 @@ function buildDelete (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request
* Perform a [delete](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete.html) request
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
@ -36,8 +36,6 @@ function buildDelete (opts) {
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {number} if_seq_no - only perform the delete operation if the last operation that has changed the document has the specified sequence number
* @param {number} if_primary_term - only perform the delete operation if the last operation that has changed the document has the specified primary term
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
@ -48,8 +46,6 @@ function buildDelete (opts) {
'refresh',
'routing',
'timeout',
'if_seq_no',
'if_primary_term',
'version',
'version_type',
'pretty',
@ -61,8 +57,6 @@ function buildDelete (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
ifSeqNo: 'if_seq_no',
ifPrimaryTerm: 'if_primary_term',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -80,6 +74,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 +96,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 +110,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 +145,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

@ -26,7 +26,7 @@ function buildDeleteByQuery (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete-by-query.html) request
*
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
@ -37,7 +37,7 @@ function buildDeleteByQuery (opts) {
* @param {number} from - Starting offset (default: 0)
* @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} conflicts - What to do when the delete by query hits version conflicts?
* @param {enum} conflicts - What to do when the delete-by-query hits version conflicts?
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
@ -49,8 +49,8 @@ function buildDeleteByQuery (opts) {
* @param {number} size - Number of hits to return (default: 10)
* @param {list} sort - A comma-separated list of <field>:<direction> pairs
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
* @param {list} stats - Specific 'tag' of the request for logging and statistical purposes
* @param {boolean} version - Specify whether to return document version as part of a hit
@ -58,8 +58,8 @@ function buildDeleteByQuery (opts) {
* @param {boolean} refresh - Should the effected indexes be refreshed?
* @param {time} timeout - Time each individual bulk request should wait for shards that are unavailable.
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. 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 {number} scroll_size - Size on the scroll request powering the delete by query
* @param {boolean} wait_for_completion - Should the request should block until the delete by query is complete.
* @param {number} scroll_size - Size on the scroll request powering the update_by_query
* @param {boolean} wait_for_completion - Should the request should block until the delete-by-query is complete.
* @param {number} requests_per_second - The throttle for this request in sub-requests per second. -1 means no throttle.
* @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
* @param {object} body - The search definition using the Query DSL
@ -85,8 +85,8 @@ function buildDeleteByQuery (opts) {
'size',
'sort',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'terminate_after',
'stats',
'version',
@ -113,8 +113,8 @@ function buildDeleteByQuery (opts) {
expandWildcards: 'expand_wildcards',
searchType: 'search_type',
searchTimeout: 'search_timeout',
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
terminateAfter: 'terminate_after',
requestCache: 'request_cache',
waitForActiveShards: 'wait_for_active_shards',
@ -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

@ -1,146 +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 buildDeleteByQueryRethrottle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request
*
* @param {string} task_id - The task id to rethrottle
* @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
*/
const acceptedQuerystring = [
'requests_per_second',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
requestsPerSecond: 'requests_per_second',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function deleteByQueryRethrottle (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params['task_id'] == null && params['taskId'] == null) {
return callback(
new ConfigurationError('Missing required parameter: task_id or taskId'),
result
)
}
if (params['requests_per_second'] == null && params['requestsPerSecond'] == null) {
return callback(
new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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, taskId, task_id } = params
var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildDeleteByQueryRethrottle

View File

@ -26,9 +26,10 @@ function buildDeleteScript (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
* Perform a [delete_script](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scripting.html) request
*
* @param {string} id - Script ID
* @param {string} lang - Script language
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
*/
@ -61,6 +62,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(
@ -68,6 +78,12 @@ function buildDeleteScript (opts) {
result
)
}
if (params['lang'] == null) {
return callback(
new ConfigurationError('Missing required parameter: lang'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -75,6 +91,14 @@ function buildDeleteScript (opts) {
)
}
// check required url components
if (params['id'] != null && (params['lang'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: lang'),
result
)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(
@ -84,8 +108,8 @@ function buildDeleteScript (opts) {
}
var warnings = null
var { method, body, id } = params
var querystring = semicopy(params, ['method', 'body', 'id'])
var { method, body, id, lang } = params
var querystring = semicopy(params, ['method', 'body', 'id', 'lang'])
if (method == null) {
method = 'DELETE'
@ -98,7 +122,11 @@ function buildDeleteScript (opts) {
var path = ''
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
if ((lang) != null && (id) != null) {
path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + '/' + encodeURIComponent(id)
} else {
path = '/' + '_scripts' + '/' + encodeURIComponent(lang)
}
// build request object
const request = {

View File

@ -22,24 +22,29 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherDeleteWatch (opts) {
function buildDeleteTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request
* Perform a [delete_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-template.html) request
*
* @param {string} id - Watch ID
* @param {string} id - Template ID
*/
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function xpackWatcherDeleteWatch (params, options, callback) {
return function deleteTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -51,6 +56,15 @@ function buildXpackWatcherDeleteWatch (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -88,7 +102,7 @@ function buildXpackWatcherDeleteWatch (opts) {
var path = ''
path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id)
path = '/' + '_search' + '/' + 'template' + '/' + encodeURIComponent(id)
// build request object
const request = {
@ -129,4 +143,4 @@ function buildXpackWatcherDeleteWatch (opts) {
}
}
module.exports = buildXpackWatcherDeleteWatch
module.exports = buildDeleteTemplate

View File

@ -26,7 +26,7 @@ function buildExists (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
* Perform a [exists](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
@ -38,8 +38,8 @@ function buildExists (opts) {
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
* @param {string} routing - Specific routing value
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
@ -52,8 +52,8 @@ function buildExists (opts) {
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'version',
'version_type',
'pretty',
@ -65,8 +65,8 @@ function buildExists (opts) {
const snakeCase = {
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -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,15 +30,15 @@ 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
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
* @param {string} routing - Specific routing value
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
@ -50,8 +50,8 @@ function buildExistsSource (opts) {
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'version',
'version_type',
'pretty',
@ -62,8 +62,8 @@ function buildExistsSource (opts) {
]
const snakeCase = {
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -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

@ -26,7 +26,7 @@ function buildExplain (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request
* Perform a [explain](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-explain.html) request
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
@ -42,8 +42,8 @@ function buildExplain (opts) {
* @param {string} q - Query in the Lucene query string syntax
* @param {string} routing - Specific routing value
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {object} body - The query definition using the Query DSL
*/
@ -59,8 +59,8 @@ function buildExplain (opts) {
'q',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'pretty',
'human',
'error_trace',
@ -72,8 +72,8 @@ function buildExplain (opts) {
analyzeWildcard: 'analyze_wildcard',
defaultOperator: 'default_operator',
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -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

@ -26,13 +26,14 @@ function buildFieldCaps (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request
* Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-caps.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} fields - A comma-separated list of field names
* @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

@ -22,31 +22,43 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackMigrationGetAssistance (opts) {
function buildFieldStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request
* Perform a [field_stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-stats.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} fields - A comma-separated list of fields for to get field statistics for (min value, max value, and more)
* @param {enum} level - Defines if field stats should be returned on a per index level or on a cluster wide level
* @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} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {object} body - Field json objects containing the name and optionally a range to filter out indices result, that have results outside the defined bounds
*/
const acceptedQuerystring = [
'fields',
'level',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'ignore_unavailable'
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
ignoreUnavailable: 'ignore_unavailable'
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function xpackMigrationGetAssistance (params, options, callback) {
return function fieldStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -58,6 +70,15 @@ function buildXpackMigrationGetAssistance (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
fieldStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(
@ -71,7 +92,7 @@ function buildXpackMigrationGetAssistance (opts) {
var querystring = semicopy(params, ['method', 'body', 'index'])
if (method == null) {
method = 'GET'
method = body == null ? 'GET' : 'POST'
}
var ignore = options.ignore || null
@ -82,16 +103,16 @@ function buildXpackMigrationGetAssistance (opts) {
var path = ''
if ((index) != null) {
path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index)
path = '/' + encodeURIComponent(index) + '/' + '_field_stats'
} else {
path = '/' + '_migration' + '/' + 'assistance'
path = '/' + '_field_stats'
}
// build request object
const request = {
method,
path,
body: null,
body: body || '',
querystring
}
@ -126,4 +147,4 @@ function buildXpackMigrationGetAssistance (opts) {
}
}
module.exports = buildXpackMigrationGetAssistance
module.exports = buildFieldStats

View File

@ -26,7 +26,7 @@ function buildGet (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
* Perform a [get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request
*
* @param {string} id - The document ID
* @param {string} index - The name of the index
@ -38,8 +38,6 @@ function buildGet (opts) {
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
* @param {string} routing - Specific routing value
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} version - Explicit version number for concurrency control
@ -54,8 +52,6 @@ function buildGet (opts) {
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'version',
@ -69,8 +65,6 @@ function buildGet (opts) {
const snakeCase = {
storedFields: 'stored_fields',
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
versionType: 'version_type',
@ -90,6 +84,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 +106,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 +142,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

@ -26,14 +26,13 @@ function buildGetScript (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
* Perform a [get_script](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scripting.html) request
*
* @param {string} id - Script ID
* @param {time} master_timeout - Specify timeout for connection to master
* @param {string} lang - Script language
*/
const acceptedQuerystring = [
'master_timeout',
'pretty',
'human',
'error_trace',
@ -42,7 +41,6 @@ function buildGetScript (opts) {
]
const snakeCase = {
masterTimeout: 'master_timeout',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -59,6 +57,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(
@ -66,6 +73,12 @@ function buildGetScript (opts) {
result
)
}
if (params['lang'] == null) {
return callback(
new ConfigurationError('Missing required parameter: lang'),
result
)
}
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
@ -73,6 +86,14 @@ function buildGetScript (opts) {
)
}
// check required url components
if (params['id'] != null && (params['lang'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: lang'),
result
)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(
@ -82,8 +103,8 @@ function buildGetScript (opts) {
}
var warnings = null
var { method, body, id } = params
var querystring = semicopy(params, ['method', 'body', 'id'])
var { method, body, id, lang } = params
var querystring = semicopy(params, ['method', 'body', 'id', 'lang'])
if (method == null) {
method = 'GET'
@ -96,7 +117,11 @@ function buildGetScript (opts) {
var path = ''
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
if ((lang) != null && (id) != null) {
path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + '/' + encodeURIComponent(id)
} else {
path = '/' + '_scripts' + '/' + encodeURIComponent(lang)
}
// build request object
const request = {

View File

@ -26,19 +26,19 @@ function buildGetSource (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
* Perform a [get_source](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request
*
* @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
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
* @param {string} routing - Specific routing value
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
* @param {list} _source_includes - A list of fields to extract and return from the _source field
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
@ -50,8 +50,8 @@ function buildGetSource (opts) {
'refresh',
'routing',
'_source',
'_source_excludes',
'_source_includes',
'_source_exclude',
'_source_include',
'version',
'version_type',
'pretty',
@ -62,8 +62,8 @@ function buildGetSource (opts) {
]
const snakeCase = {
_sourceExcludes: '_source_excludes',
_sourceIncludes: '_source_includes',
_sourceExclude: '_source_exclude',
_sourceInclude: '_source_include',
versionType: 'version_type',
errorTrace: 'error_trace',
filterPath: 'filter_path'
@ -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

@ -22,24 +22,29 @@
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildXpackWatcherGetWatch (opts) {
function buildGetTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request
* Perform a [get_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-template.html) request
*
* @param {string} id - Watch ID
* @param {string} id - Template ID
*/
const acceptedQuerystring = [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
return function xpackWatcherGetWatch (params, options, callback) {
return function getTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
@ -51,6 +56,15 @@ function buildXpackWatcherGetWatch (opts) {
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
getTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
}
// check required parameters
if (params['id'] == null) {
return callback(
@ -88,7 +102,7 @@ function buildXpackWatcherGetWatch (opts) {
var path = ''
path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id)
path = '/' + '_search' + '/' + 'template' + '/' + encodeURIComponent(id)
// build request object
const request = {
@ -129,4 +143,4 @@ function buildXpackWatcherGetWatch (opts) {
}
}
module.exports = buildXpackWatcherGetWatch
module.exports = buildGetTemplate

View File

@ -1,126 +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 buildIlmDeleteLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request
*
* @param {string} policy - The name of the index lifecycle policy
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmDeleteLifecycle (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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, policy } = params
var querystring = semicopy(params, ['method', 'body', 'policy'])
if (method == null) {
method = 'DELETE'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmDeleteLifecycle

View File

@ -1,127 +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 buildIlmExplainLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
*
* @param {string} index - The name of the index to explain
* @param {boolean} human - Return data such as dates in a human readable format
*/
const acceptedQuerystring = [
'human'
]
const snakeCase = {
}
return function ilmExplainLifecycle (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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) + '/' + '_ilm' + '/' + 'explain'
// 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,
querystring: options.querystring || 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 = buildIlmExplainLifecycle

View File

@ -1,130 +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 buildIlmGetLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html) request
*
* @param {string} policy - The name of the index lifecycle policy
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmGetLifecycle (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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, policy } = params
var querystring = semicopy(params, ['method', 'body', 'policy'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
if ((policy) != null) {
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
} else {
path = '/' + '_ilm' + '/' + 'policy'
}
// 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,
querystring: options.querystring || 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 = buildIlmGetLifecycle

View File

@ -1,125 +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 buildIlmGetStatus (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.get_status](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html) request
*
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmGetStatus (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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 } = params
var querystring = semicopy(params, ['method', 'body'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'status'
// 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,
querystring: options.querystring || 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 = buildIlmGetStatus

View File

@ -1,119 +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 buildIlmMoveToStep (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.move_to_step](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html) request
*
* @param {string} index - The name of the index whose lifecycle step is to change
* @param {object} body - The new lifecycle step to move to
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmMoveToStep (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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'move' + '/' + encodeURIComponent(index)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmMoveToStep

View File

@ -1,119 +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 buildIlmPutLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html) request
*
* @param {string} policy - The name of the index lifecycle policy
* @param {object} body - The lifecycle policy definition to register
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmPutLifecycle (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, policy } = params
var querystring = semicopy(params, ['method', 'body', 'policy'])
if (method == null) {
method = 'PUT'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmPutLifecycle

View File

@ -1,126 +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 buildIlmRemovePolicy (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.remove_policy](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html) request
*
* @param {string} index - The name of the index to remove policy on
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmRemovePolicy (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'remove'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmRemovePolicy

View File

@ -1,126 +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 buildIlmRetry (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.retry](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html) request
*
* @param {string} index - The name of the indices (comma-separated) whose failed lifecycle step is to be retry
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmRetry (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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 = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'retry'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmRetry

View File

@ -1,125 +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 buildIlmStart (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request
*
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmStart (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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 } = params
var querystring = semicopy(params, ['method', 'body'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'start'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmStart

View File

@ -1,125 +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 buildIlmStop (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [ilm.stop](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html) request
*
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function ilmStop (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// check required parameters
if (params.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),
result
)
}
// 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 } = params
var querystring = semicopy(params, ['method', 'body'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_ilm' + '/' + 'stop'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || 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 = buildIlmStop

View File

@ -26,7 +26,7 @@ function buildIndex (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [index](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request
* Perform a [index](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html) request
*
* @param {string} id - Document ID
* @param {string} index - The name of the index
@ -37,10 +37,10 @@ function buildIndex (opts) {
* @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {time} timestamp - Explicit timestamp for the document
* @param {time} ttl - Expiration time for the document
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
* @param {number} if_seq_no - only perform the index operation if the last operation that has changed the document has the specified sequence number
* @param {number} if_primary_term - only perform the index operation if the last operation that has changed the document has the specified primary term
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The document
*/
@ -52,10 +52,10 @@ function buildIndex (opts) {
'refresh',
'routing',
'timeout',
'timestamp',
'ttl',
'version',
'version_type',
'if_seq_no',
'if_primary_term',
'pipeline',
'pretty',
'human',
@ -68,8 +68,6 @@ function buildIndex (opts) {
waitForActiveShards: 'wait_for_active_shards',
opType: 'op_type',
versionType: 'version_type',
ifSeqNo: 'if_seq_no',
ifPrimaryTerm: 'if_primary_term',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -86,6 +84,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 +100,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 +114,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 +151,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

@ -26,15 +26,35 @@ function buildIndicesAnalyze (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.analyze](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html) request
* Perform a [indices.analyze](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-analyze.html) request
*
* @param {string} index - The name of the index to scope the operation
* @param {string} analyzer - The name of the analyzer to use
* @param {list} char_filter - A comma-separated list of character filters to use for the analysis
* @param {string} field - Use the analyzer configured for this field (instead of passing the analyzer name)
* @param {list} filter - A comma-separated list of filters to use for the analysis
* @param {string} index - The name of the index to scope the operation
* @param {object} body - Define analyzer/tokenizer parameters and the text on which the analysis should be performed
* @param {boolean} prefer_local - With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)
* @param {list} text - The text on which the analysis should be performed (when request body is not used)
* @param {string} tokenizer - The name of the tokenizer to use for the analysis
* @param {boolean} explain - With `true`, outputs more advanced details. (default: false)
* @param {list} attributes - A comma-separated list of token attributes to output, this parameter works only with `explain=true`
* @param {enum} format - Format of the output
* @param {object} body - The text on which the analysis should be performed
*/
const acceptedQuerystring = [
'analyzer',
'char_filter',
'field',
'filter',
'index',
'prefer_local',
'text',
'tokenizer',
'explain',
'attributes',
'format',
'pretty',
'human',
'error_trace',
@ -43,6 +63,8 @@ function buildIndicesAnalyze (opts) {
]
const snakeCase = {
charFilter: 'char_filter',
preferLocal: 'prefer_local',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -59,6 +81,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

@ -26,20 +26,24 @@ function buildIndicesClearCache (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request
* Perform a [indices.clear_cache](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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
* @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 {list} fields - A comma-separated list of fields to clear when using the `field_data` parameter (default: all)
* @param {boolean} query - Clear query caches
* @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 {list} index - A comma-separated list of index name to limit the operation
* @param {boolean} recycler - Clear the recycler cache
* @param {boolean} request_cache - Clear request cache
* @param {boolean} request - Clear request cache
*/
const acceptedQuerystring = [
'field_data',
'fielddata',
'fields',
'query',
@ -47,6 +51,8 @@ function buildIndicesClearCache (opts) {
'allow_no_indices',
'expand_wildcards',
'index',
'recycler',
'request_cache',
'request',
'pretty',
'human',
@ -56,9 +62,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 +83,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 +113,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

@ -26,7 +26,7 @@ function buildIndicesClose (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.close](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request
* Perform a [indices.close](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-open-close.html) request
*
* @param {list} index - A comma separated list of indices to close
* @param {time} timeout - Explicit operation timeout
@ -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

@ -26,21 +26,21 @@ function buildIndicesCreate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request
* Perform a [indices.create](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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

@ -26,22 +26,16 @@ function buildIndicesDelete (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html) request
* Perform a [indices.delete](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-delete-index.html) request
*
* @param {list} index - A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
* @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)
* @param {enum} expand_wildcards - Whether wildcard expressions should get expanded to open or closed indices (default: open)
*/
const acceptedQuerystring = [
'timeout',
'master_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'pretty',
'human',
'error_trace',
@ -51,9 +45,6 @@ function buildIndicesDelete (opts) {
const snakeCase = {
masterTimeout: 'master_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -70,6 +61,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

@ -26,7 +26,7 @@ function buildIndicesDeleteAlias (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.delete_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
* Perform a [indices.delete_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request
*
* @param {list} index - A comma-separated list of index names (supports wildcards); use `_all` for all indices
* @param {list} name - A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices.
@ -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

@ -26,7 +26,7 @@ function buildIndicesDeleteTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.delete_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
* Perform a [indices.delete_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-templates.html) request
*
* @param {string} name - The name of the template
* @param {time} timeout - Explicit operation timeout
@ -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

@ -26,7 +26,7 @@ function buildIndicesExists (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html) request
* Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-exists.html) request
*
* @param {list} index - A comma-separated list of index names
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
@ -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

@ -26,7 +26,7 @@ function buildIndicesExistsAlias (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.exists_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
* Perform a [indices.exists_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request
*
* @param {list} index - A comma-separated list of index names to filter aliases
* @param {list} name - A comma-separated list of alias names to return
@ -68,13 +68,16 @@ function buildIndicesExistsAlias (opts) {
options = {}
}
// check required parameters
if (params['name'] == null) {
return callback(
new ConfigurationError('Missing required parameter: name'),
result
)
// 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.body != null) {
return callback(
new ConfigurationError('This API does not require a body'),

View File

@ -26,7 +26,7 @@ function buildIndicesExistsTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.exists_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
* Perform a [indices.exists_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-templates.html) request
*
* @param {list} name - The comma separated names of the index templates
* @param {boolean} flat_settings - Return settings in flat format (default: false)
@ -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

@ -26,7 +26,7 @@ function buildIndicesExistsType (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.exists_type](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html) request
* Perform a [indices.exists_type](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-types-exists.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` to check the types across all indices
* @param {list} type - A comma-separated list of document types to check
@ -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

@ -26,7 +26,7 @@ function buildIndicesFlush (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.flush](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html) request
* Perform a [indices.flush](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-flush.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices
* @param {boolean} force - Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)
@ -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

@ -26,7 +26,7 @@ function buildIndicesFlushSynced (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request
* Perform a [indices.flush_synced](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-synced-flush.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
@ -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

@ -26,7 +26,7 @@ function buildIndicesForcemerge (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.forcemerge](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) request
* Perform a [indices.forcemerge](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-forcemerge.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {boolean} flush - Specify whether the index should be flushed after performing the operation (default: true)
@ -35,6 +35,8 @@ function buildIndicesForcemerge (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {number} max_num_segments - The number of segments the index should be merged into (default: dynamic)
* @param {boolean} only_expunge_deletes - Specify whether the operation should only expunge deleted documents
* @param {undefined} operation_threading - TODO: ?
* @param {boolean} wait_for_merge - Specify whether the request should block until the merge process is finished (default: true)
*/
const acceptedQuerystring = [
@ -44,6 +46,8 @@ function buildIndicesForcemerge (opts) {
'expand_wildcards',
'max_num_segments',
'only_expunge_deletes',
'operation_threading',
'wait_for_merge',
'pretty',
'human',
'error_trace',
@ -57,6 +61,8 @@ function buildIndicesForcemerge (opts) {
expandWildcards: 'expand_wildcards',
maxNumSegments: 'max_num_segments',
onlyExpungeDeletes: 'only_expunge_deletes',
operationThreading: 'operation_threading',
waitForMerge: 'wait_for_merge',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -73,6 +79,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

@ -26,28 +26,25 @@ function buildIndicesGet (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request
* Perform a [indices.get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 {list} feature - A comma-separated list of features
* @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)
* @param {enum} expand_wildcards - Whether wildcard expressions should get expanded to open or closed indices (default: open)
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {boolean} include_defaults - Whether to return all default setting for each of the indices.
* @param {time} master_timeout - Specify timeout for connection to master
*/
const acceptedQuerystring = [
'include_type_name',
'local',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'flat_settings',
'include_defaults',
'master_timeout',
'pretty',
'human',
'error_trace',
@ -56,13 +53,11 @@ function buildIndicesGet (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
flatSettings: 'flat_settings',
includeDefaults: 'include_defaults',
masterTimeout: 'master_timeout',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -79,6 +74,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(
@ -93,6 +97,14 @@ function buildIndicesGet (opts) {
)
}
// check required url components
if (params['feature'] != null && (params['index'] == null)) {
return callback(
new ConfigurationError('Missing required parameter of the url: index'),
result
)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
return callback(
@ -102,8 +114,8 @@ function buildIndicesGet (opts) {
}
var warnings = null
var { method, body, index } = params
var querystring = semicopy(params, ['method', 'body', 'index'])
var { method, body, index, feature } = params
var querystring = semicopy(params, ['method', 'body', 'index', 'feature'])
if (method == null) {
method = 'GET'
@ -116,7 +128,11 @@ function buildIndicesGet (opts) {
var path = ''
path = '/' + encodeURIComponent(index)
if ((index) != null && (feature) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(feature)
} else {
path = '/' + encodeURIComponent(index)
}
// build request object
const request = {

View File

@ -26,7 +26,7 @@ function buildIndicesGetAlias (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
* Perform a [indices.get_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request
*
* @param {list} index - A comma-separated list of index names to filter aliases
* @param {list} name - A comma-separated list of alias names to return
@ -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

@ -26,12 +26,11 @@ function buildIndicesGetFieldMapping (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_field_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html) request
* Perform a [indices.get_field_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-field-mapping.html) request
*
* @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

@ -26,24 +26,20 @@ function buildIndicesGetMapping (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request
* Perform a [indices.get_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-mapping.html) request
*
* @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.
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
const acceptedQuerystring = [
'include_type_name',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'master_timeout',
'local',
'pretty',
'human',
@ -53,11 +49,9 @@ function buildIndicesGetMapping (opts) {
]
const snakeCase = {
includeTypeName: 'include_type_name',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
masterTimeout: 'master_timeout',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -74,6 +68,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

@ -26,11 +26,10 @@ function buildIndicesGetSettings (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request
* Perform a [indices.get_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-settings.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} name - The name of the settings that should be included
* @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.
@ -40,7 +39,6 @@ function buildIndicesGetSettings (opts) {
*/
const acceptedQuerystring = [
'master_timeout',
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
@ -55,7 +53,6 @@ function buildIndicesGetSettings (opts) {
]
const snakeCase = {
masterTimeout: 'master_timeout',
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
@ -77,6 +74,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

@ -26,17 +26,15 @@ function buildIndicesGetTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
* Perform a [indices.get_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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

@ -26,7 +26,7 @@ function buildIndicesGetUpgrade (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.get_upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request
* Perform a [indices.get_upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-upgrade.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
@ -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

@ -26,7 +26,7 @@ function buildIndicesOpen (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.open](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request
* Perform a [indices.open](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-open-close.html) request
*
* @param {list} index - A comma separated list of indices to open
* @param {time} timeout - Explicit operation timeout
@ -34,7 +34,6 @@ function buildIndicesOpen (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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns.
*/
const acceptedQuerystring = [
@ -43,7 +42,6 @@ function buildIndicesOpen (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'wait_for_active_shards',
'pretty',
'human',
'error_trace',
@ -56,7 +54,6 @@ function buildIndicesOpen (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
waitForActiveShards: 'wait_for_active_shards',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -73,6 +70,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

@ -26,7 +26,7 @@ function buildIndicesPutAlias (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.put_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
* Perform a [indices.put_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request
*
* @param {list} index - A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices.
* @param {string} name - The name of the alias to be created or updated
@ -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

@ -26,26 +26,26 @@ function buildIndicesPutMapping (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.put_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request
* Perform a [indices.put_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-put-mapping.html) request
*
* @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

@ -26,11 +26,10 @@ function buildIndicesPutSettings (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html) request
* Perform a [indices.put_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-update-settings.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {time} master_timeout - Specify timeout for connection to master
* @param {time} timeout - Explicit operation timeout
* @param {boolean} preserve_existing - Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `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)
@ -41,7 +40,6 @@ function buildIndicesPutSettings (opts) {
const acceptedQuerystring = [
'master_timeout',
'timeout',
'preserve_existing',
'ignore_unavailable',
'allow_no_indices',
@ -77,6 +75,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

@ -26,10 +26,9 @@ function buildIndicesPutTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
* Perform a [indices.put_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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

@ -26,7 +26,7 @@ function buildIndicesRecovery (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html) request
* Perform a [indices.recovery](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-recovery.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {boolean} detailed - Whether to display detailed information about shard recovery
@ -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

@ -26,7 +26,7 @@ function buildIndicesRefresh (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.refresh](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html) request
* Perform a [indices.refresh](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-refresh.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
@ -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

@ -26,11 +26,10 @@ function buildIndicesRollover (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.rollover](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) request
* Perform a [indices.rollover](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-rollover-index.html) request
*
* @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

@ -26,12 +26,13 @@ function buildIndicesSegments (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html) request
* Perform a [indices.segments](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-segments.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @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 {undefined} operation_threading - TODO: ?
* @param {boolean} verbose - Includes detailed memory usage by Lucene.
*/
@ -39,6 +40,7 @@ function buildIndicesSegments (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'operation_threading',
'verbose',
'pretty',
'human',
@ -51,6 +53,7 @@ function buildIndicesSegments (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
operationThreading: 'operation_threading',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -67,6 +70,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

@ -26,13 +26,14 @@ function buildIndicesShardStores (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, result } = opts
/**
* Perform a [indices.shard_stores](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html) request
* Perform a [indices.shard_stores](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-shards-stores.html) request
*
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
* @param {list} status - A comma-separated list of statuses used to filter on shards to get store information for
* @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 {undefined} operation_threading - TODO: ?
*/
const acceptedQuerystring = [
@ -40,6 +41,7 @@ function buildIndicesShardStores (opts) {
'ignore_unavailable',
'allow_no_indices',
'expand_wildcards',
'operation_threading',
'pretty',
'human',
'error_trace',
@ -51,6 +53,7 @@ function buildIndicesShardStores (opts) {
ignoreUnavailable: 'ignore_unavailable',
allowNoIndices: 'allow_no_indices',
expandWildcards: 'expand_wildcards',
operationThreading: 'operation_threading',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
@ -67,6 +70,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(

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