Skip to content

Commit e3a0e9e

Browse files
committed
API generation
1 parent c35eb42 commit e3a0e9e

32 files changed

+37
-233
lines changed

api/api/clear_scroll.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ function buildClearScroll (opts) {
7878

7979
var path = ''
8080

81-
if ((scroll_id || scrollId) != null) {
82-
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
83-
} else {
84-
path = '/' + '_search' + '/' + 'scroll'
85-
}
81+
path = '/' + '_search' + '/' + 'scroll'
8682

8783
// build request object
8884
const request = {

api/api/count.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ function buildCount (opts) {
9494
options = {}
9595
}
9696

97-
// check required url components
98-
if (params['type'] != null && (params['index'] == null)) {
99-
const err = new ConfigurationError('Missing required parameter of the url: index')
100-
return handleError(err, callback)
101-
}
102-
10397
// validate headers object
10498
if (options.headers != null && typeof options.headers !== 'object') {
10599
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -121,9 +115,7 @@ function buildCount (opts) {
121115

122116
var path = ''
123117

124-
if ((index) != null && (type) != null) {
125-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
126-
} else if ((index) != null) {
118+
if ((index) != null) {
127119
path = '/' + encodeURIComponent(index) + '/' + '_count'
128120
} else {
129121
path = '/' + '_count'

api/api/create.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ function buildCreate (opts) {
112112

113113
var path = ''
114114

115-
if ((index) != null && (type) != null && (id) != null) {
116-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
117-
} else {
118-
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
119-
}
115+
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
120116

121117
// build request object
122118
const request = {

api/api/delete.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ function buildDelete (opts) {
121121

122122
var path = ''
123123

124-
if ((index) != null && (type) != null && (id) != null) {
125-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
126-
} else {
127-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
128-
}
124+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
129125

130126
// build request object
131127
const request = {

api/api/delete_by_query.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ function buildDeleteByQuery (opts) {
147147
return handleError(err, callback)
148148
}
149149

150-
// check required url components
151-
if (params['type'] != null && (params['index'] == null)) {
152-
const err = new ConfigurationError('Missing required parameter of the url: index')
153-
return handleError(err, callback)
154-
}
155-
156150
// validate headers object
157151
if (options.headers != null && typeof options.headers !== 'object') {
158152
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -174,11 +168,7 @@ function buildDeleteByQuery (opts) {
174168

175169
var path = ''
176170

177-
if ((index) != null && (type) != null) {
178-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
179-
} else {
180-
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
181-
}
171+
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
182172

183173
// build request object
184174
const request = {

api/api/exists.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,7 @@ function buildExists (opts) {
119119

120120
var path = ''
121121

122-
if ((index) != null && (type) != null && (id) != null) {
123-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
124-
} else {
125-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
126-
}
122+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
127123

128124
// build request object
129125
const request = {

api/api/exists_source.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ function buildExistsSource (opts) {
9696
}
9797

9898
// check required url components
99-
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
100-
const err = new ConfigurationError('Missing required parameter of the url: type, index')
101-
return handleError(err, callback)
102-
} else if (params['type'] != null && (params['index'] == null)) {
99+
if (params['id'] != null && (params['index'] == null)) {
103100
const err = new ConfigurationError('Missing required parameter of the url: index')
104101
return handleError(err, callback)
105102
}
@@ -125,11 +122,7 @@ function buildExistsSource (opts) {
125122

126123
var path = ''
127124

128-
if ((index) != null && (type) != null && (id) != null) {
129-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
130-
} else {
131-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
132-
}
125+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
133126

134127
// build request object
135128
const request = {

api/api/explain.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ function buildExplain (opts) {
121121

122122
var path = ''
123123

124-
if ((index) != null && (type) != null && (id) != null) {
125-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
126-
} else {
127-
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
128-
}
124+
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
129125

130126
// build request object
131127
const request = {

api/api/field_caps.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ function buildFieldCaps (opts) {
3333
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
3434
* @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)
3535
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
36+
* @param {boolean} include_unmapped - Indicates whether unmapped fields should be included in the response.
3637
*/
3738

3839
const acceptedQuerystring = [
3940
'fields',
4041
'ignore_unavailable',
4142
'allow_no_indices',
4243
'expand_wildcards',
44+
'include_unmapped',
4345
'pretty',
4446
'human',
4547
'error_trace',
@@ -51,6 +53,7 @@ function buildFieldCaps (opts) {
5153
ignoreUnavailable: 'ignore_unavailable',
5254
allowNoIndices: 'allow_no_indices',
5355
expandWildcards: 'expand_wildcards',
56+
includeUnmapped: 'include_unmapped',
5457
errorTrace: 'error_trace',
5558
filterPath: 'filter_path'
5659
}

api/api/get.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ function buildGet (opts) {
4040
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
4141
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
4242
* @param {list} _source_includes - A list of fields to extract and return from the _source field
43-
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
44-
* @param {list} _source_include - A list of fields to extract and return from the _source field
4543
* @param {number} version - Explicit version number for concurrency control
4644
* @param {enum} version_type - Specific version type
4745
*/
@@ -56,8 +54,6 @@ function buildGet (opts) {
5654
'_source',
5755
'_source_excludes',
5856
'_source_includes',
59-
'_source_exclude',
60-
'_source_include',
6157
'version',
6258
'version_type',
6359
'pretty',
@@ -71,8 +67,6 @@ function buildGet (opts) {
7167
storedFields: 'stored_fields',
7268
_sourceExcludes: '_source_excludes',
7369
_sourceIncludes: '_source_includes',
74-
_sourceExclude: '_source_exclude',
75-
_sourceInclude: '_source_include',
7670
versionType: 'version_type',
7771
errorTrace: 'error_trace',
7872
filterPath: 'filter_path'
@@ -125,11 +119,7 @@ function buildGet (opts) {
125119

126120
var path = ''
127121

128-
if ((index) != null && (type) != null && (id) != null) {
129-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
130-
} else {
131-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
132-
}
122+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
133123

134124
// build request object
135125
const request = {

api/api/get_source.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ function buildGetSource (opts) {
116116

117117
var path = ''
118118

119-
if ((index) != null && (type) != null && (id) != null) {
120-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
121-
} else {
122-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
123-
}
119+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
124120

125121
// build request object
126122
const request = {

api/api/graph.explore.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ function buildGraphExplore (opts) {
5656
options = {}
5757
}
5858

59-
// check required url components
60-
if (params['type'] != null && (params['index'] == null)) {
61-
const err = new ConfigurationError('Missing required parameter of the url: index')
62-
return handleError(err, callback)
63-
}
64-
6559
// validate headers object
6660
if (options.headers != null && typeof options.headers !== 'object') {
6761
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -83,11 +77,7 @@ function buildGraphExplore (opts) {
8377

8478
var path = ''
8579

86-
if ((index) != null && (type) != null) {
87-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore'
88-
} else {
89-
path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
90-
}
80+
path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
9181

9282
// build request object
9383
const request = {

api/api/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,8 @@ function buildIndex (opts) {
123123

124124
var path = ''
125125

126-
if ((index) != null && (type) != null && (id) != null) {
127-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
128-
} else if ((index) != null && (id) != null) {
126+
if ((index) != null && (id) != null) {
129127
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
130-
} else if ((index) != null && (type) != null) {
131-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
132128
} else {
133129
path = '/' + encodeURIComponent(index) + '/' + '_doc'
134130
}

api/api/indices.get_field_mapping.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,8 @@ function buildIndicesGetFieldMapping (opts) {
106106

107107
var path = ''
108108

109-
if ((index) != null && (type) != null && (fields) != null) {
110-
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
111-
} else if ((index) != null && (fields) != null) {
109+
if ((index) != null && (fields) != null) {
112110
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
113-
} else if ((type) != null && (fields) != null) {
114-
path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
115111
} else {
116112
path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
117113
}

api/api/indices.get_mapping.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,8 @@ function buildIndicesGetMapping (opts) {
101101

102102
var path = ''
103103

104-
if ((index) != null && (type) != null) {
105-
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
106-
} else if ((index) != null) {
104+
if ((index) != null) {
107105
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
108-
} else if ((type) != null) {
109-
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
110106
} else {
111107
path = '/' + '_mapping'
112108
}

api/api/indices.put_mapping.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,7 @@ function buildIndicesPutMapping (opts) {
102102

103103
var path = ''
104104

105-
if ((index) != null && (type) != null) {
106-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping'
107-
} else if ((index) != null && (type) != null) {
108-
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
109-
} else if ((index) != null && (type) != null) {
110-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings'
111-
} else if ((index) != null && (type) != null) {
112-
path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
113-
} else if ((type) != null) {
114-
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
115-
} else if ((type) != null) {
116-
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
117-
} else if ((index) != null) {
118-
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
119-
} else {
120-
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
121-
}
105+
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
122106

123107
// build request object
124108
const request = {

api/api/indices.validate_query.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ function buildIndicesValidateQuery (opts) {
8888
options = {}
8989
}
9090

91-
// check required url components
92-
if (params['type'] != null && (params['index'] == null)) {
93-
const err = new ConfigurationError('Missing required parameter of the url: index')
94-
return handleError(err, callback)
95-
}
96-
9791
// validate headers object
9892
if (options.headers != null && typeof options.headers !== 'object') {
9993
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -115,9 +109,7 @@ function buildIndicesValidateQuery (opts) {
115109

116110
var path = ''
117111

118-
if ((index) != null && (type) != null) {
119-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query'
120-
} else if ((index) != null) {
112+
if ((index) != null) {
121113
path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query'
122114
} else {
123115
path = '/' + '_validate' + '/' + 'query'

api/api/mget.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ function buildMget (opts) {
8383
return handleError(err, callback)
8484
}
8585

86-
// check required url components
87-
if (params['type'] != null && (params['index'] == null)) {
88-
const err = new ConfigurationError('Missing required parameter of the url: index')
89-
return handleError(err, callback)
90-
}
91-
9286
// validate headers object
9387
if (options.headers != null && typeof options.headers !== 'object') {
9488
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -110,9 +104,7 @@ function buildMget (opts) {
110104

111105
var path = ''
112106

113-
if ((index) != null && (type) != null) {
114-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget'
115-
} else if ((index) != null) {
107+
if ((index) != null) {
116108
path = '/' + encodeURIComponent(index) + '/' + '_mget'
117109
} else {
118110
path = '/' + '_mget'

api/api/monitoring.bulk.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ function buildMonitoringBulk (opts) {
8686

8787
var path = ''
8888

89-
if ((type) != null) {
90-
path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk'
91-
} else {
92-
path = '/' + '_monitoring' + '/' + 'bulk'
93-
}
89+
path = '/' + '_monitoring' + '/' + 'bulk'
9490

9591
// build request object
9692
const request = {

api/api/msearch.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ function buildMsearch (opts) {
8585
return handleError(err, callback)
8686
}
8787

88-
// check required url components
89-
if (params['type'] != null && (params['index'] == null)) {
90-
const err = new ConfigurationError('Missing required parameter of the url: index')
91-
return handleError(err, callback)
92-
}
93-
9488
// validate headers object
9589
if (options.headers != null && typeof options.headers !== 'object') {
9690
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
@@ -112,9 +106,7 @@ function buildMsearch (opts) {
112106

113107
var path = ''
114108

115-
if ((index) != null && (type) != null) {
116-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
117-
} else if ((index) != null) {
109+
if ((index) != null) {
118110
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
119111
} else {
120112
path = '/' + '_msearch'

0 commit comments

Comments
 (0)