Skip to content

Commit 6924749

Browse files
authored
Update code generation (#969)
* Updated code generation scripts to use the new spec * API generation * Fix bad link
1 parent 4ff1bd5 commit 6924749

File tree

285 files changed

+2550
-4579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+2550
-4579
lines changed

api/api/bulk.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@
1010
function buildBulk (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
15-
*
16-
* @param {string} index - Default index for items which don't provide one
17-
* @param {string} type - Default document type for items which don't provide one
18-
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
19-
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
20-
* @param {string} routing - Specific routing value
21-
* @param {time} timeout - Explicit operation timeout
22-
* @param {string} type - Default document type for items which don't provide one
23-
* @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
24-
* @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
25-
* @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
26-
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
27-
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
28-
*/
2913

3014
const acceptedQuerystring = [
3115
'wait_for_active_shards',
@@ -56,6 +40,11 @@ function buildBulk (opts) {
5640
filterPath: 'filter_path'
5741
}
5842

43+
/**
44+
* Perform a bulk request
45+
* Allows to perform multiple index/update/delete operations in a single request.
46+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html
47+
*/
5948
return function bulk (params, options, callback) {
6049
options = options || {}
6150
if (typeof options === 'function') {
@@ -90,10 +79,6 @@ function buildBulk (opts) {
9079
var { method, body, index, type, ...querystring } = params
9180
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
9281

93-
if (method == null) {
94-
method = 'POST'
95-
}
96-
9782
var ignore = options.ignore
9883
if (typeof ignore === 'number') {
9984
options.ignore = [ignore]
@@ -102,10 +87,13 @@ function buildBulk (opts) {
10287
var path = ''
10388

10489
if ((index) != null && (type) != null) {
90+
if (method == null) method = 'POST'
10591
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk'
10692
} else if ((index) != null) {
93+
if (method == null) method = 'POST'
10794
path = '/' + encodeURIComponent(index) + '/' + '_bulk'
10895
} else {
96+
if (method == null) method = 'POST'
10997
path = '/' + '_bulk'
11098
}
11199

api/api/cat.aliases.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010
function buildCatAliases (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [cat.aliases](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request
15-
*
16-
* @param {list} name - A comma-separated list of alias names to return
17-
* @param {string} format - a short version of the Accept header, e.g. json, yaml
18-
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
19-
* @param {time} master_timeout - Explicit operation timeout for connection to master node
20-
* @param {list} h - Comma-separated list of column names to display
21-
* @param {boolean} help - Return help information
22-
* @param {list} s - Comma-separated list of column names or column aliases to sort by
23-
* @param {boolean} v - Verbose mode. Display column headers
24-
*/
2513

2614
const acceptedQuerystring = [
2715
'format',
@@ -44,6 +32,11 @@ function buildCatAliases (opts) {
4432
filterPath: 'filter_path'
4533
}
4634

35+
/**
36+
* Perform a cat.aliases request
37+
* Shows information about currently configured aliases to indices including filter and routing infos.
38+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html
39+
*/
4740
return function catAliases (params, options, callback) {
4841
options = options || {}
4942
if (typeof options === 'function') {
@@ -56,12 +49,6 @@ function buildCatAliases (opts) {
5649
options = {}
5750
}
5851

59-
// check required parameters
60-
if (params.body != null) {
61-
const err = new ConfigurationError('This API does not require a body')
62-
return handleError(err, callback)
63-
}
64-
6552
// validate headers object
6653
if (options.headers != null && typeof options.headers !== 'object') {
6754
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -72,10 +59,6 @@ function buildCatAliases (opts) {
7259
var { method, body, name, ...querystring } = params
7360
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
7461

75-
if (method == null) {
76-
method = 'GET'
77-
}
78-
7962
var ignore = options.ignore
8063
if (typeof ignore === 'number') {
8164
options.ignore = [ignore]
@@ -84,8 +67,10 @@ function buildCatAliases (opts) {
8467
var path = ''
8568

8669
if ((name) != null) {
70+
if (method == null) method = 'GET'
8771
path = '/' + '_cat' + '/' + 'aliases' + '/' + encodeURIComponent(name)
8872
} else {
73+
if (method == null) method = 'GET'
8974
path = '/' + '_cat' + '/' + 'aliases'
9075
}
9176

api/api/cat.allocation.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@
1010
function buildCatAllocation (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [cat.allocation](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request
15-
*
16-
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information
17-
* @param {string} format - a short version of the Accept header, e.g. json, yaml
18-
* @param {enum} bytes - The unit in which to display byte values
19-
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
20-
* @param {time} master_timeout - Explicit operation timeout for connection to master node
21-
* @param {list} h - Comma-separated list of column names to display
22-
* @param {boolean} help - Return help information
23-
* @param {list} s - Comma-separated list of column names or column aliases to sort by
24-
* @param {boolean} v - Verbose mode. Display column headers
25-
*/
2613

2714
const acceptedQuerystring = [
2815
'format',
@@ -46,6 +33,11 @@ function buildCatAllocation (opts) {
4633
filterPath: 'filter_path'
4734
}
4835

36+
/**
37+
* Perform a cat.allocation request
38+
* Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.
39+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html
40+
*/
4941
return function catAllocation (params, options, callback) {
5042
options = options || {}
5143
if (typeof options === 'function') {
@@ -58,12 +50,6 @@ function buildCatAllocation (opts) {
5850
options = {}
5951
}
6052

61-
// check required parameters
62-
if (params.body != null) {
63-
const err = new ConfigurationError('This API does not require a body')
64-
return handleError(err, callback)
65-
}
66-
6753
// validate headers object
6854
if (options.headers != null && typeof options.headers !== 'object') {
6955
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -74,10 +60,6 @@ function buildCatAllocation (opts) {
7460
var { method, body, nodeId, node_id, ...querystring } = params
7561
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
7662

77-
if (method == null) {
78-
method = 'GET'
79-
}
80-
8163
var ignore = options.ignore
8264
if (typeof ignore === 'number') {
8365
options.ignore = [ignore]
@@ -86,8 +68,10 @@ function buildCatAllocation (opts) {
8668
var path = ''
8769

8870
if ((node_id || nodeId) != null) {
71+
if (method == null) method = 'GET'
8972
path = '/' + '_cat' + '/' + 'allocation' + '/' + encodeURIComponent(node_id || nodeId)
9073
} else {
74+
if (method == null) method = 'GET'
9175
path = '/' + '_cat' + '/' + 'allocation'
9276
}
9377

api/api/cat.count.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010
function buildCatCount (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [cat.count](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request
15-
*
16-
* @param {list} index - A comma-separated list of index names to limit the returned information
17-
* @param {string} format - a short version of the Accept header, e.g. json, yaml
18-
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
19-
* @param {time} master_timeout - Explicit operation timeout for connection to master node
20-
* @param {list} h - Comma-separated list of column names to display
21-
* @param {boolean} help - Return help information
22-
* @param {list} s - Comma-separated list of column names or column aliases to sort by
23-
* @param {boolean} v - Verbose mode. Display column headers
24-
*/
2513

2614
const acceptedQuerystring = [
2715
'format',
@@ -44,6 +32,11 @@ function buildCatCount (opts) {
4432
filterPath: 'filter_path'
4533
}
4634

35+
/**
36+
* Perform a cat.count request
37+
* Provides quick access to the document count of the entire cluster, or individual indices.
38+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html
39+
*/
4740
return function catCount (params, options, callback) {
4841
options = options || {}
4942
if (typeof options === 'function') {
@@ -56,12 +49,6 @@ function buildCatCount (opts) {
5649
options = {}
5750
}
5851

59-
// check required parameters
60-
if (params.body != null) {
61-
const err = new ConfigurationError('This API does not require a body')
62-
return handleError(err, callback)
63-
}
64-
6552
// validate headers object
6653
if (options.headers != null && typeof options.headers !== 'object') {
6754
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -72,10 +59,6 @@ function buildCatCount (opts) {
7259
var { method, body, index, ...querystring } = params
7360
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
7461

75-
if (method == null) {
76-
method = 'GET'
77-
}
78-
7962
var ignore = options.ignore
8063
if (typeof ignore === 'number') {
8164
options.ignore = [ignore]
@@ -84,8 +67,10 @@ function buildCatCount (opts) {
8467
var path = ''
8568

8669
if ((index) != null) {
70+
if (method == null) method = 'GET'
8771
path = '/' + '_cat' + '/' + 'count' + '/' + encodeURIComponent(index)
8872
} else {
73+
if (method == null) method = 'GET'
8974
path = '/' + '_cat' + '/' + 'count'
9075
}
9176

api/api/cat.fielddata.js

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@
1010
function buildCatFielddata (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [cat.fielddata](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request
15-
*
16-
* @param {list} fields - A comma-separated list of fields to return the fielddata size
17-
* @param {string} format - a short version of the Accept header, e.g. json, yaml
18-
* @param {enum} bytes - The unit in which to display byte values
19-
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
20-
* @param {time} master_timeout - Explicit operation timeout for connection to master node
21-
* @param {list} h - Comma-separated list of column names to display
22-
* @param {boolean} help - Return help information
23-
* @param {list} s - Comma-separated list of column names or column aliases to sort by
24-
* @param {boolean} v - Verbose mode. Display column headers
25-
* @param {list} fields - A comma-separated list of fields to return in the output
26-
*/
2713

2814
const acceptedQuerystring = [
2915
'format',
@@ -48,6 +34,11 @@ function buildCatFielddata (opts) {
4834
filterPath: 'filter_path'
4935
}
5036

37+
/**
38+
* Perform a cat.fielddata request
39+
* Shows how much heap memory is currently being used by fielddata on every data node in the cluster.
40+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html
41+
*/
5142
return function catFielddata (params, options, callback) {
5243
options = options || {}
5344
if (typeof options === 'function') {
@@ -60,12 +51,6 @@ function buildCatFielddata (opts) {
6051
options = {}
6152
}
6253

63-
// check required parameters
64-
if (params.body != null) {
65-
const err = new ConfigurationError('This API does not require a body')
66-
return handleError(err, callback)
67-
}
68-
6954
// validate headers object
7055
if (options.headers != null && typeof options.headers !== 'object') {
7156
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -76,10 +61,6 @@ function buildCatFielddata (opts) {
7661
var { method, body, fields, ...querystring } = params
7762
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
7863

79-
if (method == null) {
80-
method = 'GET'
81-
}
82-
8364
var ignore = options.ignore
8465
if (typeof ignore === 'number') {
8566
options.ignore = [ignore]
@@ -88,8 +69,10 @@ function buildCatFielddata (opts) {
8869
var path = ''
8970

9071
if ((fields) != null) {
72+
if (method == null) method = 'GET'
9173
path = '/' + '_cat' + '/' + 'fielddata' + '/' + encodeURIComponent(fields)
9274
} else {
75+
if (method == null) method = 'GET'
9376
path = '/' + '_cat' + '/' + 'fielddata'
9477
}
9578

api/api/cat.health.js

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010
function buildCatHealth (opts) {
1111
// eslint-disable-next-line no-unused-vars
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13-
/**
14-
* Perform a [cat.health](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request
15-
*
16-
* @param {string} format - a short version of the Accept header, e.g. json, yaml
17-
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
18-
* @param {time} master_timeout - Explicit operation timeout for connection to master node
19-
* @param {list} h - Comma-separated list of column names to display
20-
* @param {boolean} help - Return help information
21-
* @param {list} s - Comma-separated list of column names or column aliases to sort by
22-
* @param {boolean} ts - Set to false to disable timestamping
23-
* @param {boolean} v - Verbose mode. Display column headers
24-
*/
2513

2614
const acceptedQuerystring = [
2715
'format',
@@ -45,6 +33,11 @@ function buildCatHealth (opts) {
4533
filterPath: 'filter_path'
4634
}
4735

36+
/**
37+
* Perform a cat.health request
38+
* Returns a concise representation of the cluster health.
39+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html
40+
*/
4841
return function catHealth (params, options, callback) {
4942
options = options || {}
5043
if (typeof options === 'function') {
@@ -57,12 +50,6 @@ function buildCatHealth (opts) {
5750
options = {}
5851
}
5952

60-
// check required parameters
61-
if (params.body != null) {
62-
const err = new ConfigurationError('This API does not require a body')
63-
return handleError(err, callback)
64-
}
65-
6653
// validate headers object
6754
if (options.headers != null && typeof options.headers !== 'object') {
6855
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -73,17 +60,14 @@ function buildCatHealth (opts) {
7360
var { method, body, ...querystring } = params
7461
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
7562

76-
if (method == null) {
77-
method = 'GET'
78-
}
79-
8063
var ignore = options.ignore
8164
if (typeof ignore === 'number') {
8265
options.ignore = [ignore]
8366
}
8467

8568
var path = ''
8669

70+
if (method == null) method = 'GET'
8771
path = '/' + '_cat' + '/' + 'health'
8872

8973
// build request object

0 commit comments

Comments
 (0)