Skip to content

Support for deprecated paths #828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion api/api/clear_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ function buildClearScroll (opts) {

var path = ''

path = '/' + '_search' + '/' + 'scroll'
if ((scroll_id || scrollId) != null) {
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
} else {
path = '/' + '_search' + '/' + 'scroll'
}

// build request object
const request = {
Expand Down
10 changes: 9 additions & 1 deletion api/api/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ function buildCount (opts) {
options = {}
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -115,7 +121,9 @@ function buildCount (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_count'
} else {
path = '/' + '_count'
Expand Down
6 changes: 5 additions & 1 deletion api/api/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function buildCreate (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
12 changes: 5 additions & 7 deletions api/api/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ function buildDelete (opts) {
return handleError(err, callback)
}

// check required url components
if (params['id'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -121,7 +115,11 @@ function buildDelete (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
12 changes: 11 additions & 1 deletion api/api/delete_by_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ function buildDeleteByQuery (opts) {
return handleError(err, callback)
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -168,7 +174,11 @@ function buildDeleteByQuery (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
}

// build request object
const request = {
Expand Down
6 changes: 5 additions & 1 deletion api/api/exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ function buildExists (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
11 changes: 9 additions & 2 deletions api/api/exists_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ function buildExistsSource (opts) {
}

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

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
6 changes: 5 additions & 1 deletion api/api/explain.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ function buildExplain (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
6 changes: 5 additions & 1 deletion api/api/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ function buildGet (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
6 changes: 5 additions & 1 deletion api/api/get_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ function buildGetSource (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
}

// build request object
const request = {
Expand Down
12 changes: 11 additions & 1 deletion api/api/graph.explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ function buildGraphExplore (opts) {
options = {}
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -77,7 +83,11 @@ function buildGraphExplore (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore'
}

// build request object
const request = {
Expand Down
12 changes: 5 additions & 7 deletions api/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ function buildIndex (opts) {
return handleError(err, callback)
}

// check required url components
if (params['id'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -123,8 +117,12 @@ function buildIndex (opts) {

var path = ''

if ((index) != null && (id) != null) {
if ((index) != null && (type) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
} else if ((index) != null && (id) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type)
} else {
path = '/' + encodeURIComponent(index) + '/' + '_doc'
}
Expand Down
6 changes: 5 additions & 1 deletion api/api/indices.get_field_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ function buildIndicesGetFieldMapping (opts) {

var path = ''

if ((index) != null && (fields) != null) {
if ((index) != null && (type) != null && (fields) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
} else if ((index) != null && (fields) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
} else if ((type) != null && (fields) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type) + '/' + 'field' + '/' + encodeURIComponent(fields)
} else {
path = '/' + '_mapping' + '/' + 'field' + '/' + encodeURIComponent(fields)
}
Expand Down
6 changes: 5 additions & 1 deletion api/api/indices.get_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ function buildIndicesGetMapping (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else {
path = '/' + '_mapping'
}
Expand Down
18 changes: 17 additions & 1 deletion api/api/indices.put_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,23 @@ function buildIndicesPutMapping (opts) {

var path = ''

path = '/' + encodeURIComponent(index) + '/' + '_mapping'
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mapping'
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mappings'
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
}

// build request object
const request = {
Expand Down
10 changes: 9 additions & 1 deletion api/api/indices.validate_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ function buildIndicesValidateQuery (opts) {
options = {}
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -109,7 +115,9 @@ function buildIndicesValidateQuery (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query'
} else {
path = '/' + '_validate' + '/' + 'query'
Expand Down
10 changes: 9 additions & 1 deletion api/api/mget.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ function buildMget (opts) {
return handleError(err, callback)
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -104,7 +110,9 @@ function buildMget (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mget'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mget'
} else {
path = '/' + '_mget'
Expand Down
6 changes: 5 additions & 1 deletion api/api/monitoring.bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ function buildMonitoringBulk (opts) {

var path = ''

path = '/' + '_monitoring' + '/' + 'bulk'
if ((type) != null) {
path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk'
} else {
path = '/' + '_monitoring' + '/' + 'bulk'
}

// build request object
const request = {
Expand Down
10 changes: 9 additions & 1 deletion api/api/msearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ function buildMsearch (opts) {
return handleError(err, callback)
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -106,7 +112,9 @@ function buildMsearch (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch'
} else {
path = '/' + '_msearch'
Expand Down
10 changes: 9 additions & 1 deletion api/api/msearch_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ function buildMsearchTemplate (opts) {
return handleError(err, callback)
}

// check required url components
if (params['type'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}

// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -100,7 +106,9 @@ function buildMsearchTemplate (opts) {

var path = ''

if ((index) != null) {
if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_msearch' + '/' + 'template'
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_msearch' + '/' + 'template'
} else {
path = '/' + '_msearch' + '/' + 'template'
Expand Down
Loading