­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ /* * 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 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') const acceptedQuerystring = ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'run_expensive_tasks', 'flush', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards'] const snakeCase = { masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', runExpensiveTasks: 'run_expensive_tasks', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' } function IndicesApi (transport, ConfigurationError) { this.transport = transport this[kConfigurationError] = ConfigurationError } IndicesApi.prototype.addBlock = function indicesAddBlockApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.block == null) { const err = new this[kConfigurationError]('Missing required parameter: block') return handleError(err, callback) } // check required url components if (params.block != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, block, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_block' + '/' + encodeURIComponent(block) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.analyze = function indicesAnalyzeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_analyze' } else { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + '_analyze' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.clearCache = function indicesClearCacheApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_cache' + '/' + 'clear' } else { if (method == null) method = 'POST' path = '/' + '_cache' + '/' + 'clear' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.clone = function indicesCloneApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.target == null) { const err = new this[kConfigurationError]('Missing required parameter: target') return handleError(err, callback) } // check required url components if (params.target != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, target, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_clone' + '/' + encodeURIComponent(target) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.close = function indicesCloseApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_close' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.create = function indicesCreateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.createDataStream = function indicesCreateDataStreamApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + '_data_stream' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.dataStreamsStats = function indicesDataStreamsStatsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_data_stream' + '/' + encodeURIComponent(name) + '/' + '_stats' } else { if (method == null) method = 'GET' path = '/' + '_data_stream' + '/' + '_stats' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.delete = function indicesDeleteApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'DELETE' path = '/' + encodeURIComponent(index) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.deleteAlias = function indicesDeleteAliasApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } // check required url components if (params.name != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (name) != null) { if (method == null) method = 'DELETE' path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'DELETE' path = '/' + encodeURIComponent(index) + '/' + '_aliases' + '/' + encodeURIComponent(name) } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.deleteDataStream = function indicesDeleteDataStreamApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'DELETE' path = '/' + '_data_stream' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.deleteIndexTemplate = function indicesDeleteIndexTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'DELETE' path = '/' + '_index_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.deleteTemplate = function indicesDeleteTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'DELETE' path = '/' + '_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.diskUsage = function indicesDiskUsageApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_disk_usage' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.exists = function indicesExistsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'HEAD' path = '/' + encodeURIComponent(index) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.existsAlias = function indicesExistsAliasApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (name) != null) { if (method == null) method = 'HEAD' path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'HEAD' path = '/' + '_alias' + '/' + encodeURIComponent(name) } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.existsIndexTemplate = function indicesExistsIndexTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'HEAD' path = '/' + '_index_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.existsTemplate = function indicesExistsTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'HEAD' path = '/' + '_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.existsType = function indicesExistsTypeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.type == null) { const err = new this[kConfigurationError]('Missing required parameter: type') return handleError(err, callback) } // check required url components if (params.type != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'HEAD' path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.fieldUsageStats = function indicesFieldUsageStatsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_field_usage_stats' // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.flush = function indicesFlushApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_flush' } else { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + '_flush' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.flushSynced = function indicesFlushSyncedApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_flush' + '/' + 'synced' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.forcemerge = function indicesForcemergeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_forcemerge' } else { if (method == null) method = 'POST' path = '/' + '_forcemerge' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.freeze = function indicesFreezeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_freeze' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.get = function indicesGetApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getAlias = function indicesGetAliasApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (name) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name) } else if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_alias' + '/' + encodeURIComponent(name) } else if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_alias' } else { if (method == null) method = 'GET' path = '/' + '_alias' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getDataStream = function indicesGetDataStreamApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_data_stream' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'GET' path = '/' + '_data_stream' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getFieldMapping = function indicesGetFieldMappingApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.fields == null) { const err = new this[kConfigurationError]('Missing required parameter: fields') return handleError(err, callback) } let { method, body, fields, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (type) != null && (fields) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) } else if ((index) != null && (fields) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) } else if ((type) != null && (fields) != null) { if (method == null) method = 'GET' path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields) } else { if (method == null) method = 'GET' path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields) } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getIndexTemplate = function indicesGetIndexTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_index_template' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'GET' path = '/' + '_index_template' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getMapping = function indicesGetMappingApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (type) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) } else if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_mapping' } else if ((type) != null) { if (method == null) method = 'GET' path = '/' + '_mapping' + '/' + encodeURIComponent(type) } else { if (method == null) method = 'GET' path = '/' + '_mapping' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getSettings = function indicesGetSettingsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (name) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_settings' + '/' + encodeURIComponent(name) } else if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_settings' } else if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_settings' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'GET' path = '/' + '_settings' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getTemplate = function indicesGetTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((name) != null) { if (method == null) method = 'GET' path = '/' + '_template' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'GET' path = '/' + '_template' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.getUpgrade = function indicesGetUpgradeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_upgrade' // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.migrateToDataStream = function indicesMigrateToDataStreamApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + '_data_stream' + '/' + '_migrate' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.open = function indicesOpenApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_open' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.promoteDataStream = function indicesPromoteDataStreamApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + '_data_stream' + '/' + '_promote' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.putAlias = function indicesPutAliasApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } // check required url components if (params.name != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (name) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_alias' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_aliases' + '/' + encodeURIComponent(name) } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.putIndexTemplate = function indicesPutIndexTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } if (params.body == null) { const err = new this[kConfigurationError]('Missing required parameter: body') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + '_index_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.putMapping = function indicesPutMappingApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.body == null) { const err = new this[kConfigurationError]('Missing required parameter: body') return handleError(err, callback) } let { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (type) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping' } else if ((index) != null && (type) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) } else if ((index) != null && (type) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings' } else if ((index) != null && (type) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type) } else if ((index) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_mapping' } else if ((type) != null) { if (method == null) method = 'PUT' path = '/' + '_mappings' + '/' + encodeURIComponent(type) } else if ((index) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_mappings' } else { if (method == null) method = 'PUT' path = '/' + '_mapping' + '/' + encodeURIComponent(type) } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.putSettings = function indicesPutSettingsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.body == null) { const err = new this[kConfigurationError]('Missing required parameter: body') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_settings' } else { if (method == null) method = 'PUT' path = '/' + '_settings' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.putTemplate = function indicesPutTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } if (params.body == null) { const err = new this[kConfigurationError]('Missing required parameter: body') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + '_template' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.recovery = function indicesRecoveryApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_recovery' } else { if (method == null) method = 'GET' path = '/' + '_recovery' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.refresh = function indicesRefreshApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_refresh' } else { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + '_refresh' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.reloadSearchAnalyzers = function indicesReloadSearchAnalyzersApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.resolveIndex = function indicesResolveIndexApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'GET' path = '/' + '_resolve' + '/' + 'index' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.rollover = function indicesRolloverApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.alias == null) { const err = new this[kConfigurationError]('Missing required parameter: alias') return handleError(err, callback) } // check required url components if ((params.new_index != null || params.newIndex != null) && (params.alias == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: alias') return handleError(err, callback) } let { method, body, alias, newIndex, new_index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((alias) != null && (new_index || newIndex) != null) { if (method == null) method = 'POST' path = '/' + encodeURIComponent(alias) + '/' + '_rollover' + '/' + encodeURIComponent(new_index || newIndex) } else { if (method == null) method = 'POST' path = '/' + encodeURIComponent(alias) + '/' + '_rollover' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.segments = function indicesSegmentsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_segments' } else { if (method == null) method = 'GET' path = '/' + '_segments' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.shardStores = function indicesShardStoresApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_shard_stores' } else { if (method == null) method = 'GET' path = '/' + '_shard_stores' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.shrink = function indicesShrinkApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.target == null) { const err = new this[kConfigurationError]('Missing required parameter: target') return handleError(err, callback) } // check required url components if (params.target != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, target, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_shrink' + '/' + encodeURIComponent(target) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.simulateIndexTemplate = function indicesSimulateIndexTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.name == null) { const err = new this[kConfigurationError]('Missing required parameter: name') return handleError(err, callback) } let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + '_index_template' + '/' + '_simulate_index' + '/' + encodeURIComponent(name) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.simulateTemplate = function indicesSimulateTemplateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, name, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((name) != null) { if (method == null) method = 'POST' path = '/' + '_index_template' + '/' + '_simulate' + '/' + encodeURIComponent(name) } else { if (method == null) method = 'POST' path = '/' + '_index_template' + '/' + '_simulate' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.split = function indicesSplitApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } if (params.target == null) { const err = new this[kConfigurationError]('Missing required parameter: target') return handleError(err, callback) } // check required url components if (params.target != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, target, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'PUT' path = '/' + encodeURIComponent(index) + '/' + '_split' + '/' + encodeURIComponent(target) // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.stats = function indicesStatsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, metric, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (metric) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_stats' + '/' + encodeURIComponent(metric) } else if ((metric) != null) { if (method == null) method = 'GET' path = '/' + '_stats' + '/' + encodeURIComponent(metric) } else if ((index) != null) { if (method == null) method = 'GET' path = '/' + encodeURIComponent(index) + '/' + '_stats' } else { if (method == null) method = 'GET' path = '/' + '_stats' } // build request object const request = { method, path, body: null, querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.unfreeze = function indicesUnfreezeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.index == null) { const err = new this[kConfigurationError]('Missing required parameter: index') return handleError(err, callback) } let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_unfreeze' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required parameters if (params.body == null) { const err = new this[kConfigurationError]('Missing required parameter: body') return handleError(err, callback) } let { method, body, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + '_aliases' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.upgrade = function indicesUpgradeApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) let { method, body, index, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if (method == null) method = 'POST' path = '/' + encodeURIComponent(index) + '/' + '_upgrade' // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } IndicesApi.prototype.validateQuery = function indicesValidateQueryApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) // check required url components if (params.type != null && (params.index == null)) { const err = new this[kConfigurationError]('Missing required parameter of the url: index') return handleError(err, callback) } let { method, body, index, type, ...querystring } = params querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) let path = '' if ((index) != null && (type) != null) { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query' } else if ((index) != null) { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query' } else { if (method == null) method = body == null ? 'GET' : 'POST' path = '/' + '_validate' + '/' + 'query' } // build request object const request = { method, path, body: body || '', querystring } return this.transport.request(request, options, callback) } Object.defineProperties(IndicesApi.prototype, { add_block: { get () { return this.addBlock } }, clear_cache: { get () { return this.clearCache } }, create_data_stream: { get () { return this.createDataStream } }, data_streams_stats: { get () { return this.dataStreamsStats } }, delete_alias: { get () { return this.deleteAlias } }, delete_data_stream: { get () { return this.deleteDataStream } }, delete_index_template: { get () { return this.deleteIndexTemplate } }, delete_template: { get () { return this.deleteTemplate } }, disk_usage: { get () { return this.diskUsage } }, exists_alias: { get () { return this.existsAlias } }, exists_index_template: { get () { return this.existsIndexTemplate } }, exists_template: { get () { return this.existsTemplate } }, exists_type: { get () { return this.existsType } }, field_usage_stats: { get () { return this.fieldUsageStats } }, flush_synced: { get () { return this.flushSynced } }, get_alias: { get () { return this.getAlias } }, get_data_stream: { get () { return this.getDataStream } }, get_field_mapping: { get () { return this.getFieldMapping } }, get_index_template: { get () { return this.getIndexTemplate } }, get_mapping: { get () { return this.getMapping } }, get_settings: { get () { return this.getSettings } }, get_template: { get () { return this.getTemplate } }, get_upgrade: { get () { return this.getUpgrade } }, migrate_to_data_stream: { get () { return this.migrateToDataStream } }, promote_data_stream: { get () { return this.promoteDataStream } }, put_alias: { get () { return this.putAlias } }, put_index_template: { get () { return this.putIndexTemplate } }, put_mapping: { get () { return this.putMapping } }, put_settings: { get () { return this.putSettings } }, put_template: { get () { return this.putTemplate } }, reload_search_analyzers: { get () { return this.reloadSearchAnalyzers } }, resolve_index: { get () { return this.resolveIndex } }, shard_stores: { get () { return this.shardStores } }, simulate_index_template: { get () { return this.simulateIndexTemplate } }, simulate_template: { get () { return this.simulateTemplate } }, update_aliases: { get () { return this.updateAliases } }, validate_query: { get () { return this.validateQuery } } }) module.exports = IndicesApi