Merge branch 'master' into 7.x
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
|
||||
function buildSearchTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request
|
||||
*
|
||||
@ -103,26 +103,20 @@ function buildSearchTemplate (opts) {
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
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') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
Reference in New Issue
Block a user