Skip to content

Commit 844206e

Browse files
authored
Patch deprecated parameters (#851)
* Updated code generation * API generation * API generation * Updated code generation
1 parent ea1ecad commit 844206e

22 files changed

+126
-125
lines changed

api/api/bulk.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ function buildBulk (opts) {
5050
'type',
5151
'_source',
5252
'_source_excludes',
53+
'_source_exclude',
5354
'_source_includes',
55+
'_source_include',
5456
'pipeline',
5557
'pretty',
5658
'human',
@@ -62,7 +64,9 @@ function buildBulk (opts) {
6264
const snakeCase = {
6365
waitForActiveShards: 'wait_for_active_shards',
6466
_sourceExcludes: '_source_excludes',
67+
_sourceExclude: '_source_exclude',
6568
_sourceIncludes: '_source_includes',
69+
_sourceInclude: '_source_include',
6670
errorTrace: 'error_trace',
6771
filterPath: 'filter_path'
6872
}

api/api/delete_by_query.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function buildDeleteByQuery (opts) {
2929
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request
3030
*
3131
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
32-
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
3332
* @param {string} analyzer - The analyzer to use for the query string
3433
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
3534
* @param {enum} default_operator - The default operator for query string query (AND or OR)
@@ -86,7 +85,9 @@ function buildDeleteByQuery (opts) {
8685
'sort',
8786
'_source',
8887
'_source_excludes',
88+
'_source_exclude',
8989
'_source_includes',
90+
'_source_include',
9091
'terminate_after',
9192
'stats',
9293
'version',
@@ -114,7 +115,9 @@ function buildDeleteByQuery (opts) {
114115
searchType: 'search_type',
115116
searchTimeout: 'search_timeout',
116117
_sourceExcludes: '_source_excludes',
118+
_sourceExclude: '_source_exclude',
117119
_sourceIncludes: '_source_includes',
120+
_sourceInclude: '_source_include',
118121
terminateAfter: 'terminate_after',
119122
requestCache: 'request_cache',
120123
waitForActiveShards: 'wait_for_active_shards',
@@ -147,20 +150,14 @@ function buildDeleteByQuery (opts) {
147150
return handleError(err, callback)
148151
}
149152

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-
156153
// validate headers object
157154
if (options.headers != null && typeof options.headers !== 'object') {
158155
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
159156
return handleError(err, callback)
160157
}
161158

162159
var warnings = []
163-
var { method, body, index, type, ...querystring } = params
160+
var { method, body, index, ...querystring } = params
164161
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
165162

166163
if (method == null) {
@@ -174,11 +171,7 @@ function buildDeleteByQuery (opts) {
174171

175172
var path = ''
176173

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-
}
174+
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
182175

183176
// build request object
184177
const request = {

api/api/exists.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ function buildExists (opts) {
5353
'routing',
5454
'_source',
5555
'_source_excludes',
56+
'_source_exclude',
5657
'_source_includes',
58+
'_source_include',
5759
'version',
5860
'version_type',
5961
'pretty',
@@ -66,7 +68,9 @@ function buildExists (opts) {
6668
const snakeCase = {
6769
storedFields: 'stored_fields',
6870
_sourceExcludes: '_source_excludes',
71+
_sourceExclude: '_source_exclude',
6972
_sourceIncludes: '_source_includes',
73+
_sourceInclude: '_source_include',
7074
versionType: 'version_type',
7175
errorTrace: 'error_trace',
7276
filterPath: 'filter_path'

api/api/exists_source.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ function buildExistsSource (opts) {
5151
'routing',
5252
'_source',
5353
'_source_excludes',
54+
'_source_exclude',
5455
'_source_includes',
56+
'_source_include',
5557
'version',
5658
'version_type',
5759
'pretty',
@@ -63,7 +65,9 @@ function buildExistsSource (opts) {
6365

6466
const snakeCase = {
6567
_sourceExcludes: '_source_excludes',
68+
_sourceExclude: '_source_exclude',
6669
_sourceIncludes: '_source_includes',
70+
_sourceInclude: '_source_include',
6771
versionType: 'version_type',
6872
errorTrace: 'error_trace',
6973
filterPath: 'filter_path'

api/api/explain.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ function buildExplain (opts) {
6060
'routing',
6161
'_source',
6262
'_source_excludes',
63+
'_source_exclude',
6364
'_source_includes',
65+
'_source_include',
6466
'pretty',
6567
'human',
6668
'error_trace',
@@ -73,7 +75,9 @@ function buildExplain (opts) {
7375
defaultOperator: 'default_operator',
7476
storedFields: 'stored_fields',
7577
_sourceExcludes: '_source_excludes',
78+
_sourceExclude: '_source_exclude',
7679
_sourceIncludes: '_source_includes',
80+
_sourceInclude: '_source_include',
7781
errorTrace: 'error_trace',
7882
filterPath: 'filter_path'
7983
}

api/api/get.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ function buildGet (opts) {
5353
'routing',
5454
'_source',
5555
'_source_excludes',
56+
'_source_exclude',
5657
'_source_includes',
58+
'_source_include',
5759
'version',
5860
'version_type',
5961
'pretty',
@@ -66,7 +68,9 @@ function buildGet (opts) {
6668
const snakeCase = {
6769
storedFields: 'stored_fields',
6870
_sourceExcludes: '_source_excludes',
71+
_sourceExclude: '_source_exclude',
6972
_sourceIncludes: '_source_includes',
73+
_sourceInclude: '_source_include',
7074
versionType: 'version_type',
7175
errorTrace: 'error_trace',
7276
filterPath: 'filter_path'

api/api/get_source.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ function buildGetSource (opts) {
5151
'routing',
5252
'_source',
5353
'_source_excludes',
54+
'_source_exclude',
5455
'_source_includes',
56+
'_source_include',
5557
'version',
5658
'version_type',
5759
'pretty',
@@ -63,7 +65,9 @@ function buildGetSource (opts) {
6365

6466
const snakeCase = {
6567
_sourceExcludes: '_source_excludes',
68+
_sourceExclude: '_source_exclude',
6669
_sourceIncludes: '_source_includes',
70+
_sourceInclude: '_source_include',
6771
versionType: 'version_type',
6872
errorTrace: 'error_trace',
6973
filterPath: 'filter_path'

api/api/mget.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function buildMget (opts) {
4949
'routing',
5050
'_source',
5151
'_source_excludes',
52+
'_source_exclude',
5253
'_source_includes',
54+
'_source_include',
5355
'pretty',
5456
'human',
5557
'error_trace',
@@ -60,7 +62,9 @@ function buildMget (opts) {
6062
const snakeCase = {
6163
storedFields: 'stored_fields',
6264
_sourceExcludes: '_source_excludes',
65+
_sourceExclude: '_source_exclude',
6366
_sourceIncludes: '_source_includes',
67+
_sourceInclude: '_source_include',
6468
errorTrace: 'error_trace',
6569
filterPath: 'filter_path'
6670
}

api/api/msearch.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function buildMsearch (opts) {
2929
* Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request
3030
*
3131
* @param {list} index - A comma-separated list of index names to use as default
32-
* @param {list} type - A comma-separated list of document types to use as default
3332
* @param {enum} search_type - Search operation type
3433
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
3534
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
@@ -85,20 +84,14 @@ function buildMsearch (opts) {
8584
return handleError(err, callback)
8685
}
8786

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-
9487
// validate headers object
9588
if (options.headers != null && typeof options.headers !== 'object') {
9689
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
9790
return handleError(err, callback)
9891
}
9992

10093
var warnings = []
101-
var { method, body, index, type, ...querystring } = params
94+
var { method, body, index, ...querystring } = params
10295
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
10396

10497
if (method == null) {
@@ -112,9 +105,7 @@ function buildMsearch (opts) {
112105

113106
var path = ''
114107

115-
if ((index) != null && (type) != null) {
116-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
117-
} else if ((index) != null) {
108+
if ((index) != null) {
118109
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
119110
} else {
120111
path = '/' + '_msearch'

api/api/msearch_template.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function buildMsearchTemplate (opts) {
2929
* Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request
3030
*
3131
* @param {list} index - A comma-separated list of index names to use as default
32-
* @param {list} type - A comma-separated list of document types to use as default
3332
* @param {enum} search_type - Search operation type
3433
* @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response
3534
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
@@ -79,20 +78,14 @@ function buildMsearchTemplate (opts) {
7978
return handleError(err, callback)
8079
}
8180

82-
// check required url components
83-
if (params['type'] != null && (params['index'] == null)) {
84-
const err = new ConfigurationError('Missing required parameter of the url: index')
85-
return handleError(err, callback)
86-
}
87-
8881
// validate headers object
8982
if (options.headers != null && typeof options.headers !== 'object') {
9083
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
9184
return handleError(err, callback)
9285
}
9386

9487
var warnings = []
95-
var { method, body, index, type, ...querystring } = params
88+
var { method, body, index, ...querystring } = params
9689
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
9790

9891
if (method == null) {
@@ -106,9 +99,7 @@ function buildMsearchTemplate (opts) {
10699

107100
var path = ''
108101

109-
if ((index) != null && (type) != null) {
110-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template'
111-
} else if ((index) != null) {
102+
if ((index) != null) {
112103
path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template'
113104
} else {
114105
path = '/' + '_msearch' + '/' + 'template'

api/api/mtermvectors.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function buildMtermvectors (opts) {
2929
* Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request
3030
*
3131
* @param {string} index - The index in which the document resides.
32-
* @param {string} type - The type of the document.
3332
* @param {list} ids - A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
3433
* @param {boolean} term_statistics - Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
3534
* @param {boolean} field_statistics - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
@@ -87,20 +86,14 @@ function buildMtermvectors (opts) {
8786
options = {}
8887
}
8988

90-
// check required url components
91-
if (params['type'] != null && (params['index'] == null)) {
92-
const err = new ConfigurationError('Missing required parameter of the url: index')
93-
return handleError(err, callback)
94-
}
95-
9689
// validate headers object
9790
if (options.headers != null && typeof options.headers !== 'object') {
9891
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
9992
return handleError(err, callback)
10093
}
10194

10295
var warnings = []
103-
var { method, body, index, type, ...querystring } = params
96+
var { method, body, index, ...querystring } = params
10497
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
10598

10699
if (method == null) {
@@ -114,9 +107,7 @@ function buildMtermvectors (opts) {
114107

115108
var path = ''
116109

117-
if ((index) != null && (type) != null) {
118-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mtermvectors'
119-
} else if ((index) != null) {
110+
if ((index) != null) {
120111
path = '/' + encodeURIComponent(index) + '/' + '_mtermvectors'
121112
} else {
122113
path = '/' + '_mtermvectors'

api/api/search.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function buildSearch (opts) {
2929
* Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request
3030
*
3131
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
32-
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
3332
* @param {string} analyzer - The analyzer to use for the query string
3433
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
3534
* @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
@@ -99,7 +98,9 @@ function buildSearch (opts) {
9998
'sort',
10099
'_source',
101100
'_source_excludes',
101+
'_source_exclude',
102102
'_source_includes',
103+
'_source_include',
103104
'terminate_after',
104105
'stats',
105106
'suggest_field',
@@ -137,7 +138,9 @@ function buildSearch (opts) {
137138
expandWildcards: 'expand_wildcards',
138139
searchType: 'search_type',
139140
_sourceExcludes: '_source_excludes',
141+
_sourceExclude: '_source_exclude',
140142
_sourceIncludes: '_source_includes',
143+
_sourceInclude: '_source_include',
141144
terminateAfter: 'terminate_after',
142145
suggestField: 'suggest_field',
143146
suggestMode: 'suggest_mode',
@@ -169,20 +172,14 @@ function buildSearch (opts) {
169172
options = {}
170173
}
171174

172-
// check required url components
173-
if (params['type'] != null && (params['index'] == null)) {
174-
const err = new ConfigurationError('Missing required parameter of the url: index')
175-
return handleError(err, callback)
176-
}
177-
178175
// validate headers object
179176
if (options.headers != null && typeof options.headers !== 'object') {
180177
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
181178
return handleError(err, callback)
182179
}
183180

184181
var warnings = []
185-
var { method, body, index, type, ...querystring } = params
182+
var { method, body, index, ...querystring } = params
186183
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
187184

188185
if (method == null) {
@@ -196,9 +193,7 @@ function buildSearch (opts) {
196193

197194
var path = ''
198195

199-
if ((index) != null && (type) != null) {
200-
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search'
201-
} else if ((index) != null) {
196+
if ((index) != null) {
202197
path = '/' + encodeURIComponent(index) + '/' + '_search'
203198
} else {
204199
path = '/' + '_search'

0 commit comments

Comments
 (0)