Elasticsearch 7 support 🚀 (#760)
* API generation * Updated typings * Updated code generation * Updated test * Updated ci configuration * Fixed test
This commit is contained in:
committed by
GitHub
parent
bd2755a302
commit
7acd2e3b07
@ -13,10 +13,9 @@ 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_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 {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 {string} pipeline - The pipeline id to preprocess incoming documents with
|
||||
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
|
||||
*/
|
||||
@ -65,10 +64,9 @@ function buildBulk (opts) {
|
||||
'routing',
|
||||
'timeout',
|
||||
'type',
|
||||
'fields',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'pipeline',
|
||||
'pretty',
|
||||
'human',
|
||||
@ -82,10 +80,9 @@ function buildBulk (opts) {
|
||||
'routing',
|
||||
'timeout',
|
||||
'type',
|
||||
'fields',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'pipeline',
|
||||
'pretty',
|
||||
'human',
|
||||
@ -125,11 +122,20 @@ function buildBulk (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + '_bulk'
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_bulk'
|
||||
} else {
|
||||
path = '/' + '_bulk'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], '_bulk']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
bulkBody: params.body,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,18 @@ function buildCatAliases (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['name']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'aliases' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'aliases'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'aliases', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -109,11 +109,18 @@ function buildCatAllocation (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['node_id'] || params['nodeId']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'allocation' + '/' + encodeURIComponent(params['node_id'] || params['nodeId'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'allocation'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'allocation', params['node_id'] || params['nodeId']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,18 @@ function buildCatCount (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'count' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'count'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'count', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -112,11 +112,18 @@ function buildCatFielddata (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['fields']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'fielddata' + '/' + encodeURIComponent(params['fields'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'fielddata'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'fielddata', params['fields']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -108,11 +108,14 @@ function buildCatHealth (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'health'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'health']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -90,11 +90,14 @@ function buildCatHelp (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -115,11 +115,18 @@ function buildCatIndices (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'indices' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'indices'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'indices', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -105,11 +105,14 @@ function buildCatMaster (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'master'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'master']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -105,11 +105,14 @@ function buildCatNodeattrs (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'nodeattrs'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'nodeattrs']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -108,11 +108,14 @@ function buildCatNodes (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'nodes'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'nodes']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -105,11 +105,14 @@ function buildCatPendingTasks (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'pending_tasks'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'pending_tasks']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -105,11 +105,14 @@ function buildCatPlugins (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'plugins'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'plugins']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,18 @@ function buildCatRecovery (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'recovery' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'recovery'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'recovery', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -105,11 +105,14 @@ function buildCatRepositories (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'repositories'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'repositories']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -103,11 +103,18 @@ function buildCatSegments (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'segments' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'segments'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'segments', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -109,11 +109,18 @@ function buildCatShards (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'shards' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'shards'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'shards', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,18 @@ function buildCatSnapshots (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['repository']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'snapshots' + '/' + encodeURIComponent(params['repository'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'snapshots'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'snapshots', params['repository']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -111,11 +111,14 @@ function buildCatTasks (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'tasks'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'tasks']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,18 @@ function buildCatTemplates (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['name']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'templates' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'templates'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'templates', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -109,11 +109,18 @@ function buildCatThreadPool (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['thread_pool_patterns'] || params['threadPoolPatterns']) != null) {
|
||||
path = '/' + '_cat' + '/' + 'thread_pool' + '/' + encodeURIComponent(params['thread_pool_patterns'] || params['threadPoolPatterns'])
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'thread_pool'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cat', 'thread_pool', params['thread_pool_patterns'] || params['threadPoolPatterns']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -77,11 +77,14 @@ function buildCcrDeleteAutoFollowPattern (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(params['name'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_ccr', 'auto_follow', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -84,11 +84,14 @@ function buildCcrFollow (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_ccr' + '/' + 'follow'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_ccr', 'follow']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -69,11 +69,14 @@ function buildCcrFollowStats (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_ccr' + '/' + 'stats'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_ccr', 'stats']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -69,11 +69,18 @@ function buildCcrGetAutoFollowPattern (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['name']) != null) {
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_ccr', 'auto_follow', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -77,11 +77,14 @@ function buildCcrPauseFollow (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_ccr' + '/' + 'pause_follow'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_ccr', 'pause_follow']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -84,11 +84,14 @@ function buildCcrPutAutoFollowPattern (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(params['name'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_ccr', 'auto_follow', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -84,11 +84,14 @@ function buildCcrResumeFollow (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_ccr' + '/' + 'resume_follow'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_ccr', 'resume_follow']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -68,11 +68,14 @@ function buildCcrStats (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'stats'
|
||||
|
||||
// build request object
|
||||
const parts = ['_ccr', 'stats']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -77,11 +77,14 @@ function buildCcrUnfollow (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_ccr' + '/' + 'unfollow'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_ccr', 'unfollow']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -78,11 +78,18 @@ function buildClearScroll (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['scroll_id'] || params['scrollId']) != null) {
|
||||
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(params['scroll_id'] || params['scrollId'])
|
||||
} else {
|
||||
path = '/' + '_search' + '/' + 'scroll'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_search', 'scroll', params['scroll_id'] || params['scrollId']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -83,11 +83,14 @@ function buildClusterAllocationExplain (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'allocation', 'explain']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -96,11 +96,14 @@ function buildClusterGetSettings (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'settings'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'settings']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -115,11 +115,18 @@ function buildClusterHealth (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(params['index'])
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'health'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'health', params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -90,11 +90,14 @@ function buildClusterPendingTasks (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'pending_tasks'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'pending_tasks']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,14 @@ function buildClusterPutSettings (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'settings'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'settings']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -84,11 +84,14 @@ function buildClusterRemoteInfo (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_remote' + '/' + 'info'
|
||||
|
||||
// build request object
|
||||
const parts = ['_remote', 'info']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -95,11 +95,14 @@ function buildClusterReroute (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'reroute'
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'reroute']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@ function buildClusterState (opts) {
|
||||
* @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.
|
||||
@ -58,6 +60,8 @@ function buildClusterState (opts) {
|
||||
'local',
|
||||
'master_timeout',
|
||||
'flat_settings',
|
||||
'wait_for_metadata_version',
|
||||
'wait_for_timeout',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
@ -71,6 +75,8 @@ function buildClusterState (opts) {
|
||||
'local',
|
||||
'masterTimeout',
|
||||
'flatSettings',
|
||||
'waitForMetadataVersion',
|
||||
'waitForTimeout',
|
||||
'ignoreUnavailable',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
@ -112,11 +118,20 @@ function buildClusterState (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['metric']) != null && (params['index']) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(params['metric']) + '/' + encodeURIComponent(params['index'])
|
||||
} else if ((params['metric']) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(params['metric'])
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'state'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'state', params['metric'], params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -91,13 +91,18 @@ function buildClusterStats (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['node_id'] || params['nodeId']) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'stats' + '/' + 'nodes' + '/' + encodeURIComponent(params['node_id'] || params['nodeId'])
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'stats'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_cluster', 'stats', 'nodes', params['node_id'] || params['nodeId']]
|
||||
const request = {
|
||||
method,
|
||||
path: (params['node_id'] || params['nodeId']) != null
|
||||
? '/' + parts.filter(Boolean).map(encodeURIComponent).join('/')
|
||||
: '/_cluster/stats',
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ function buildCount (opts) {
|
||||
* @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
|
||||
@ -56,6 +57,7 @@ function buildCount (opts) {
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'ignore_unavailable',
|
||||
'ignore_throttled',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'min_score',
|
||||
@ -76,6 +78,7 @@ function buildCount (opts) {
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'ignoreUnavailable',
|
||||
'ignoreThrottled',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
'minScore',
|
||||
@ -126,11 +129,20 @@ function buildCount (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + '_count'
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_count'
|
||||
} else {
|
||||
path = '/' + '_count'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], '_count']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -143,11 +143,14 @@ function buildCreate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id']) + '/' + '_create'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id'], '_create']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -50,12 +50,6 @@ 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'),
|
||||
@ -64,12 +58,7 @@ function buildDelete (opts) {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if (params['id'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
@ -139,11 +128,18 @@ function buildDelete (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_doc' + '/' + encodeURIComponent(params['id'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -27,8 +27,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_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 {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 {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
|
||||
@ -107,8 +107,8 @@ function buildDeleteByQuery (opts) {
|
||||
'size',
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'version',
|
||||
@ -146,8 +146,8 @@ function buildDeleteByQuery (opts) {
|
||||
'size',
|
||||
'sort',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'terminateAfter',
|
||||
'stats',
|
||||
'version',
|
||||
@ -197,11 +197,18 @@ function buildDeleteByQuery (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + '_delete_by_query'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_delete_by_query'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], '_delete_by_query']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -100,11 +100,14 @@ function buildDeleteByQueryRethrottle (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_delete_by_query' + '/' + encodeURIComponent(params['task_id'] || params['taskId']) + '/' + '_rethrottle'
|
||||
|
||||
// build request object
|
||||
const parts = ['_delete_by_query', params['task_id'] || params['taskId'], '_rethrottle']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -97,11 +97,14 @@ function buildDeleteScript (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_scripts' + '/' + encodeURIComponent(params['id'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_scripts', params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -16,8 +16,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_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 {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 {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
@ -54,12 +54,6 @@ 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'),
|
||||
@ -67,19 +61,6 @@ function buildExists (opts) {
|
||||
)
|
||||
}
|
||||
|
||||
// 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
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
@ -91,8 +72,8 @@ function buildExists (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -109,8 +90,8 @@ function buildExists (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'version',
|
||||
'versionType',
|
||||
'pretty',
|
||||
@ -151,11 +132,18 @@ function buildExists (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_doc' + '/' + encodeURIComponent(params['id'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ function buildExistsSource (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_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 {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 {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
@ -89,8 +89,8 @@ function buildExistsSource (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -106,8 +106,8 @@ function buildExistsSource (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'version',
|
||||
'versionType',
|
||||
'pretty',
|
||||
@ -148,11 +148,14 @@ function buildExistsSource (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id']) + '/' + '_source'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id'], '_source']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -20,8 +20,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_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 {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 {object} body - The query definition using the Query DSL
|
||||
*/
|
||||
return function explain (params, options, callback) {
|
||||
@ -57,25 +57,6 @@ function buildExplain (opts) {
|
||||
result
|
||||
)
|
||||
}
|
||||
if (params['type'] == null) {
|
||||
return callback(
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
@ -92,8 +73,8 @@ function buildExplain (opts) {
|
||||
'q',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -112,8 +93,8 @@ function buildExplain (opts) {
|
||||
'q',
|
||||
'routing',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'pretty',
|
||||
'human',
|
||||
'errorTrace',
|
||||
@ -152,11 +133,18 @@ function buildExplain (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id']) + '/' + '_explain'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_explain' + '/' + encodeURIComponent(params['id'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id'], '_explain']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ function buildFieldCaps (opts) {
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
* @param {object} body - Field json objects containing an array of field names
|
||||
*/
|
||||
return function fieldCaps (params, options, callback) {
|
||||
options = options || {}
|
||||
@ -33,6 +32,14 @@ function buildFieldCaps (opts) {
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
@ -90,12 +97,19 @@ function buildFieldCaps (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_field_caps'
|
||||
} else {
|
||||
path = '/' + '_field_caps'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_field_caps']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
body: params.body || '',
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@ 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,12 +56,6 @@ 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'),
|
||||
@ -67,19 +63,6 @@ function buildGet (opts) {
|
||||
)
|
||||
}
|
||||
|
||||
// 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
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
@ -91,6 +74,8 @@ function buildGet (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'version',
|
||||
@ -109,6 +94,8 @@ function buildGet (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'version',
|
||||
@ -151,11 +138,18 @@ function buildGet (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_doc' + '/' + encodeURIComponent(params['id'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,14 @@ function buildGetScript (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_scripts' + '/' + encodeURIComponent(params['id'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_scripts', params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ function buildGetSource (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_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 {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 {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
@ -89,8 +89,8 @@ function buildGetSource (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
@ -106,8 +106,8 @@ function buildGetSource (opts) {
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_sourceExclude',
|
||||
'_sourceInclude',
|
||||
'_sourceExcludes',
|
||||
'_sourceIncludes',
|
||||
'version',
|
||||
'versionType',
|
||||
'pretty',
|
||||
@ -148,11 +148,14 @@ function buildGetSource (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id']) + '/' + '_source'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id'], '_source']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
104
api/api/ilm.delete_lifecycle.js
Normal file
104
api/api/ilm.delete_lifecycle.js
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmDeleteLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(params['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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmDeleteLifecycle
|
||||
105
api/api/ilm.explain_lifecycle.js
Normal file
105
api/api/ilm.explain_lifecycle.js
Normal file
@ -0,0 +1,105 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmExplainLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'human'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'human'
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmExplainLifecycle
|
||||
108
api/api/ilm.get_lifecycle.js
Normal file
108
api/api/ilm.get_lifecycle.js
Normal file
@ -0,0 +1,108 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmGetLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['policy']) != null) {
|
||||
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(params['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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmGetLifecycle
|
||||
103
api/api/ilm.get_status.js
Normal file
103
api/api/ilm.get_status.js
Normal file
@ -0,0 +1,103 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmGetStatus(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmGetStatus
|
||||
97
api/api/ilm.move_to_step.js
Normal file
97
api/api/ilm.move_to_step.js
Normal file
@ -0,0 +1,97 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmMoveToStep(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ilm' + '/' + 'move' + '/' + encodeURIComponent(params['index'])
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmMoveToStep
|
||||
97
api/api/ilm.put_lifecycle.js
Normal file
97
api/api/ilm.put_lifecycle.js
Normal file
@ -0,0 +1,97 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmPutLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'PUT'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(params['policy'])
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmPutLifecycle
|
||||
104
api/api/ilm.remove_policy.js
Normal file
104
api/api/ilm.remove_policy.js
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmRemovePolicy(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmRemovePolicy
|
||||
104
api/api/ilm.retry.js
Normal file
104
api/api/ilm.retry.js
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmRetry(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmRetry
|
||||
@ -1,13 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
function buildXpackWatcherRestart (opts) {
|
||||
function buildIlmStart (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
/**
|
||||
* Perform a [xpack.watcher.restart](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html) request
|
||||
* Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request
|
||||
*
|
||||
*/
|
||||
return function xpackWatcherRestart (params, options, callback) {
|
||||
return function ilmStart (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
@ -21,7 +21,7 @@ function buildXpackWatcherRestart (opts) {
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
xpackWatcherRestart(params, options, (err, body) => {
|
||||
ilmStart(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
@ -76,11 +76,14 @@ function buildXpackWatcherRestart (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ilm' + '/' + 'start'
|
||||
|
||||
// build request object
|
||||
const parts = ['_xpack', 'watcher', '_restart']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
@ -97,4 +100,4 @@ function buildXpackWatcherRestart (opts) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildXpackWatcherRestart
|
||||
module.exports = buildIlmStart
|
||||
103
api/api/ilm.stop.js
Normal file
103
api/api/ilm.stop.js
Normal file
@ -0,0 +1,103 @@
|
||||
'use strict'
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
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 = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmStop(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmStop
|
||||
@ -47,12 +47,6 @@ 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'),
|
||||
@ -61,12 +55,7 @@ function buildIndex (opts) {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if (params['id'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
@ -140,11 +129,22 @@ function buildIndex (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + encodeURIComponent(params['id'])
|
||||
} else if ((params['index']) != null && (params['id']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_doc' + '/' + encodeURIComponent(params['id'])
|
||||
} else if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_doc'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], params['type'], params['id']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -81,11 +81,18 @@ function buildIndicesAnalyze (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_analyze'
|
||||
} else {
|
||||
path = '/' + '_analyze'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_analyze']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ function buildIndicesClearCache (opts) {
|
||||
* Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index name to limit the operation
|
||||
* @param {boolean} field_data - Clear field data. This is deprecated. Prefer `fielddata`.
|
||||
* @param {boolean} fielddata - Clear field data
|
||||
* @param {list} fields - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)
|
||||
* @param {boolean} query - Clear query caches
|
||||
@ -15,7 +14,6 @@ function buildIndicesClearCache (opts) {
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
* @param {list} index - A comma-separated list of index name to limit the operation
|
||||
* @param {boolean} request_cache - Clear request cache
|
||||
* @param {boolean} request - Clear request cache
|
||||
*/
|
||||
return function indicesClearCache (params, options, callback) {
|
||||
@ -50,7 +48,6 @@ function buildIndicesClearCache (opts) {
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'field_data',
|
||||
'fielddata',
|
||||
'fields',
|
||||
'query',
|
||||
@ -58,7 +55,6 @@ function buildIndicesClearCache (opts) {
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'index',
|
||||
'request_cache',
|
||||
'request',
|
||||
'pretty',
|
||||
'human',
|
||||
@ -67,7 +63,6 @@ function buildIndicesClearCache (opts) {
|
||||
'filter_path'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'fieldData',
|
||||
'fielddata',
|
||||
'fields',
|
||||
'query',
|
||||
@ -75,7 +70,6 @@ function buildIndicesClearCache (opts) {
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
'index',
|
||||
'requestCache',
|
||||
'request',
|
||||
'pretty',
|
||||
'human',
|
||||
@ -99,7 +93,7 @@ function buildIndicesClearCache (opts) {
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = params.body == null ? 'GET' : 'POST'
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
@ -115,11 +109,18 @@ function buildIndicesClearCache (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_cache' + '/' + 'clear'
|
||||
} else {
|
||||
path = '/' + '_cache' + '/' + 'clear'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_cache', 'clear']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,14 @@ function buildIndicesClose (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_close'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_close']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -7,10 +7,10 @@ function buildIndicesCreate (opts) {
|
||||
* Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request
|
||||
*
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} 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`)
|
||||
*/
|
||||
return function indicesCreate (params, options, callback) {
|
||||
@ -45,10 +45,10 @@ function buildIndicesCreate (opts) {
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'include_type_name',
|
||||
'wait_for_active_shards',
|
||||
'timeout',
|
||||
'master_timeout',
|
||||
'update_all_types',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -56,10 +56,10 @@ function buildIndicesCreate (opts) {
|
||||
'filter_path'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'includeTypeName',
|
||||
'waitForActiveShards',
|
||||
'timeout',
|
||||
'masterTimeout',
|
||||
'updateAllTypes',
|
||||
'pretty',
|
||||
'human',
|
||||
'errorTrace',
|
||||
@ -98,11 +98,14 @@ function buildIndicesCreate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -106,11 +106,14 @@ function buildIndicesDelete (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -112,13 +112,18 @@ function buildIndicesDeleteAlias (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['name']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_aliases' + '/' + encodeURIComponent(params['name'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_aliases', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: params['index'] != null && params['name'] != null
|
||||
? '/' + parts.filter(Boolean).map(encodeURIComponent).join('/')
|
||||
: '/{index}/_alias/{name}',
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -97,11 +97,14 @@ function buildIndicesDeleteTemplate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_template' + '/' + encodeURIComponent(params['name'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_template', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -109,11 +109,14 @@ function buildIndicesExists (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -104,11 +104,18 @@ function buildIndicesExistsAlias (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['name']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_alias', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -100,11 +100,14 @@ function buildIndicesExistsTemplate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_template' + '/' + encodeURIComponent(params['name'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_template', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -118,11 +118,14 @@ function buildIndicesExistsType (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping' + '/' + encodeURIComponent(params['type'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_mapping', params['type']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -100,11 +100,18 @@ function buildIndicesFlush (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_flush'
|
||||
} else {
|
||||
path = '/' + '_flush'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_flush']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,18 @@ function buildIndicesFlushSynced (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_flush' + '/' + 'synced'
|
||||
} else {
|
||||
path = '/' + '_flush' + '/' + 'synced'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_flush', 'synced']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -103,11 +103,18 @@ function buildIndicesForcemerge (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_forcemerge'
|
||||
} else {
|
||||
path = '/' + '_forcemerge'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_forcemerge']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
126
api/api/indices.freeze.js
Normal file
126
api/api/indices.freeze.js
Normal file
@ -0,0 +1,126 @@
|
||||
'use strict'
|
||||
|
||||
function buildIndicesFreeze (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
|
||||
*
|
||||
* @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 {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.
|
||||
*/
|
||||
return function indicesFreeze (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesFreeze(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'timeout',
|
||||
'master_timeout',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'wait_for_active_shards'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'timeout',
|
||||
'masterTimeout',
|
||||
'ignoreUnavailable',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
'waitForActiveShards'
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_freeze'
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesFreeze
|
||||
@ -112,11 +112,14 @@ function buildIndicesGet (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -98,11 +98,22 @@ function buildIndicesGetAlias (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['name']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
} else if ((params['name']) != null) {
|
||||
path = '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_alias'
|
||||
} else {
|
||||
path = '/' + '_alias'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_alias', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -108,11 +108,22 @@ function buildIndicesGetFieldMapping (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null && (params['fields']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping' + '/' + encodeURIComponent(params['type']) + '/' + 'field' + '/' + encodeURIComponent(params['fields'])
|
||||
} else if ((params['index']) != null && (params['fields']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(params['fields'])
|
||||
} else if ((params['type']) != null && (params['fields']) != null) {
|
||||
path = '/' + '_mapping' + '/' + encodeURIComponent(params['type']) + '/' + 'field' + '/' + encodeURIComponent(params['fields'])
|
||||
} else {
|
||||
path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(params['fields'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_mapping', params['type'], 'field', params['fields']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ function buildIndicesGetMapping (opts) {
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names
|
||||
* @param {list} type - A comma-separated list of document types
|
||||
* @param {string} include_type_name - Whether to add the type name to the response
|
||||
* @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.
|
||||
@ -46,6 +47,7 @@ function buildIndicesGetMapping (opts) {
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'include_type_name',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
@ -58,6 +60,7 @@ function buildIndicesGetMapping (opts) {
|
||||
'filter_path'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'includeTypeName',
|
||||
'ignoreUnavailable',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
@ -101,11 +104,22 @@ function buildIndicesGetMapping (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping' + '/' + encodeURIComponent(params['type'])
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping'
|
||||
} else if ((params['type']) != null) {
|
||||
path = '/' + '_mapping' + '/' + encodeURIComponent(params['type'])
|
||||
} else {
|
||||
path = '/' + '_mapping'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_mapping', params['type']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,11 +107,22 @@ function buildIndicesGetSettings (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['name']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_settings' + '/' + encodeURIComponent(params['name'])
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_settings'
|
||||
} else if ((params['name']) != null) {
|
||||
path = '/' + '_settings' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_settings'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_settings', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,18 @@ function buildIndicesGetTemplate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['name']) != null) {
|
||||
path = '/' + '_template' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + '_template'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = ['_template', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,18 @@ function buildIndicesGetUpgrade (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_upgrade'
|
||||
} else {
|
||||
path = '/' + '_upgrade'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_upgrade']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -109,11 +109,14 @@ function buildIndicesOpen (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_open'
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_open']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,13 +107,18 @@ function buildIndicesPutAlias (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['name']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_alias' + '/' + encodeURIComponent(params['name'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_aliases' + '/' + encodeURIComponent(params['name'])
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_aliases', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: params['index'] != null && params['name'] != null
|
||||
? '/' + parts.filter(Boolean).map(encodeURIComponent).join('/')
|
||||
: '/{index}/_alias/{name}',
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -8,12 +8,12 @@ function buildIndicesPutMapping (opts) {
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.
|
||||
* @param {string} type - The name of the document type
|
||||
* @param {string} 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
|
||||
*/
|
||||
return function indicesPutMapping (params, options, callback) {
|
||||
@ -37,12 +37,6 @@ function buildIndicesPutMapping (opts) {
|
||||
}
|
||||
|
||||
// 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'),
|
||||
@ -54,12 +48,12 @@ function buildIndicesPutMapping (opts) {
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'include_type_name',
|
||||
'timeout',
|
||||
'master_timeout',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'update_all_types',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
@ -67,12 +61,12 @@ function buildIndicesPutMapping (opts) {
|
||||
'filter_path'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'includeTypeName',
|
||||
'timeout',
|
||||
'masterTimeout',
|
||||
'ignoreUnavailable',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
'updateAllTypes',
|
||||
'pretty',
|
||||
'human',
|
||||
'errorTrace',
|
||||
@ -111,11 +105,30 @@ function buildIndicesPutMapping (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + '_mapping'
|
||||
} else if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping' + '/' + encodeURIComponent(params['type'])
|
||||
} else if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + encodeURIComponent(params['type']) + '/' + '_mappings'
|
||||
} else if ((params['index']) != null && (params['type']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mappings' + '/' + encodeURIComponent(params['type'])
|
||||
} else if ((params['type']) != null) {
|
||||
path = '/' + '_mapping' + '/' + encodeURIComponent(params['type'])
|
||||
} else if ((params['type']) != null) {
|
||||
path = '/' + '_mappings' + '/' + encodeURIComponent(params['type'])
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mappings'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_mapping'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_mappings', params['type']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,11 +107,18 @@ function buildIndicesPutSettings (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_settings'
|
||||
} else {
|
||||
path = '/' + '_settings'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_settings']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,11 +107,14 @@ function buildIndicesPutTemplate (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_template' + '/' + encodeURIComponent(params['name'])
|
||||
|
||||
// build request object
|
||||
const parts = ['_template', params['name']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -91,11 +91,18 @@ function buildIndicesRecovery (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_recovery'
|
||||
} else {
|
||||
path = '/' + '_recovery'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_recovery']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -94,11 +94,18 @@ function buildIndicesRefresh (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_refresh'
|
||||
} else {
|
||||
path = '/' + '_refresh'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_refresh']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,11 +107,18 @@ function buildIndicesRollover (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['alias']) != null && (params['new_index'] || params['newIndex']) != null) {
|
||||
path = '/' + encodeURIComponent(params['alias']) + '/' + '_rollover' + '/' + encodeURIComponent(params['new_index'] || params['newIndex'])
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(params['alias']) + '/' + '_rollover'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['alias'], '_rollover', params['new_index'] || params['newIndex']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -97,11 +97,18 @@ function buildIndicesSegments (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_segments'
|
||||
} else {
|
||||
path = '/' + '_segments'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_segments']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -97,11 +97,18 @@ function buildIndicesShardStores (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_shard_stores'
|
||||
} else {
|
||||
path = '/' + '_shard_stores'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_shard_stores']
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -113,11 +113,14 @@ function buildIndicesShrink (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_shrink' + '/' + encodeURIComponent(params['target'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_shrink', params['target']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -113,11 +113,14 @@ function buildIndicesSplit (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_split' + '/' + encodeURIComponent(params['target'])
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_split', params['target']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: params.body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
@ -107,11 +107,22 @@ function buildIndicesStats (opts) {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((params['index']) != null && (params['metric']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_stats' + '/' + encodeURIComponent(params['metric'])
|
||||
} else if ((params['metric']) != null) {
|
||||
path = '/' + '_stats' + '/' + encodeURIComponent(params['metric'])
|
||||
} else if ((params['index']) != null) {
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_stats'
|
||||
} else {
|
||||
path = '/' + '_stats'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const parts = [params['index'], '_stats', params['metric']]
|
||||
const request = {
|
||||
method,
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
126
api/api/indices.unfreeze.js
Normal file
126
api/api/indices.unfreeze.js
Normal file
@ -0,0 +1,126 @@
|
||||
'use strict'
|
||||
|
||||
function buildIndicesUnfreeze (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
/**
|
||||
* Perform a [indices.unfreeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request
|
||||
*
|
||||
* @param {string} index - The name of the index to unfreeze
|
||||
* @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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns.
|
||||
*/
|
||||
return function indicesUnfreeze (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesUnfreeze(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
// build querystring object
|
||||
const querystring = {}
|
||||
const keys = Object.keys(params)
|
||||
const acceptedQuerystring = [
|
||||
'timeout',
|
||||
'master_timeout',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'wait_for_active_shards'
|
||||
]
|
||||
const acceptedQuerystringCamelCased = [
|
||||
'timeout',
|
||||
'masterTimeout',
|
||||
'ignoreUnavailable',
|
||||
'allowNoIndices',
|
||||
'expandWildcards',
|
||||
'waitForActiveShards'
|
||||
]
|
||||
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (acceptedQuerystring.indexOf(key) !== -1) {
|
||||
querystring[key] = params[key]
|
||||
} else {
|
||||
var camelIndex = acceptedQuerystringCamelCased.indexOf(key)
|
||||
if (camelIndex !== -1) {
|
||||
querystring[acceptedQuerystring[camelIndex]] = params[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure http method
|
||||
var method = params.method
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (params.headers != null && typeof params.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`),
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(params['index']) + '/' + '_unfreeze'
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesUnfreeze
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user