API generation

This commit is contained in:
delvedor
2018-12-12 16:46:44 +01:00
parent 230b08ab86
commit ab90797b65
238 changed files with 4268 additions and 1661 deletions

View File

@ -20,15 +20,21 @@ function buildBulk (opts) {
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
*/
return function bulk (params, callback) {
return function bulk (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
bulk(params, (err, body) => {
bulk(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -114,7 +120,7 @@ function buildBulk (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -126,12 +132,17 @@ function buildBulk (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
bulkBody: params.body,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatAliases (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catAliases (params, callback) {
return function catAliases (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catAliases(params, (err, body) => {
catAliases(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildCatAliases (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildCatAliases (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildCatAllocation (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catAllocation (params, callback) {
return function catAllocation (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catAllocation(params, (err, body) => {
catAllocation(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -98,7 +104,7 @@ function buildCatAllocation (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildCatAllocation (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatCount (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catCount (params, callback) {
return function catCount (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catCount(params, (err, body) => {
catCount(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildCatCount (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildCatCount (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -17,15 +17,21 @@ function buildCatFielddata (opts) {
* @param {boolean} v - Verbose mode. Display column headers
* @param {list} fields - A comma-separated list of fields to return in the output
*/
return function catFielddata (params, callback) {
return function catFielddata (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catFielddata(params, (err, body) => {
catFielddata(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -101,7 +107,7 @@ function buildCatFielddata (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -113,12 +119,17 @@ function buildCatFielddata (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatHealth (opts) {
* @param {boolean} ts - Set to false to disable timestamping
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catHealth (params, callback) {
return function catHealth (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catHealth(params, (err, body) => {
catHealth(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -97,7 +103,7 @@ function buildCatHealth (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -109,12 +115,17 @@ function buildCatHealth (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildCatHelp (opts) {
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
*/
return function catHelp (params, callback) {
return function catHelp (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catHelp(params, (err, body) => {
catHelp(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -79,7 +85,7 @@ function buildCatHelp (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -91,12 +97,17 @@ function buildCatHelp (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -18,15 +18,21 @@ function buildCatIndices (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catIndices (params, callback) {
return function catIndices (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catIndices(params, (err, body) => {
catIndices(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -104,7 +110,7 @@ function buildCatIndices (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -116,12 +122,17 @@ function buildCatIndices (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatMaster (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catMaster (params, callback) {
return function catMaster (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catMaster(params, (err, body) => {
catMaster(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -94,7 +100,7 @@ function buildCatMaster (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -106,12 +112,17 @@ function buildCatMaster (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatNodeattrs (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catNodeattrs (params, callback) {
return function catNodeattrs (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catNodeattrs(params, (err, body) => {
catNodeattrs(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -94,7 +100,7 @@ function buildCatNodeattrs (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -106,12 +112,17 @@ function buildCatNodeattrs (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatNodes (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catNodes (params, callback) {
return function catNodes (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catNodes(params, (err, body) => {
catNodes(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -97,7 +103,7 @@ function buildCatNodes (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -109,12 +115,17 @@ function buildCatNodes (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatPendingTasks (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catPendingTasks (params, callback) {
return function catPendingTasks (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catPendingTasks(params, (err, body) => {
catPendingTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -94,7 +100,7 @@ function buildCatPendingTasks (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -106,12 +112,17 @@ function buildCatPendingTasks (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatPlugins (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catPlugins (params, callback) {
return function catPlugins (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catPlugins(params, (err, body) => {
catPlugins(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -94,7 +100,7 @@ function buildCatPlugins (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -106,12 +112,17 @@ function buildCatPlugins (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatRecovery (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catRecovery (params, callback) {
return function catRecovery (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catRecovery(params, (err, body) => {
catRecovery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildCatRecovery (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildCatRecovery (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatRepositories (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catRepositories (params, callback) {
return function catRepositories (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catRepositories(params, (err, body) => {
catRepositories(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -94,7 +100,7 @@ function buildCatRepositories (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -106,12 +112,17 @@ function buildCatRepositories (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildCatSegments (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catSegments (params, callback) {
return function catSegments (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catSegments(params, (err, body) => {
catSegments(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -92,7 +98,7 @@ function buildCatSegments (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -104,12 +110,17 @@ function buildCatSegments (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildCatShards (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catShards (params, callback) {
return function catShards (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catShards(params, (err, body) => {
catShards(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -98,7 +104,7 @@ function buildCatShards (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildCatShards (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatSnapshots (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catSnapshots (params, callback) {
return function catSnapshots (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catSnapshots(params, (err, body) => {
catSnapshots(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildCatSnapshots (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildCatSnapshots (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildCatTasks (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catTasks (params, callback) {
return function catTasks (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catTasks(params, (err, body) => {
catTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -100,7 +106,7 @@ function buildCatTasks (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -112,12 +118,17 @@ function buildCatTasks (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildCatTemplates (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catTemplates (params, callback) {
return function catTemplates (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catTemplates(params, (err, body) => {
catTemplates(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildCatTemplates (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildCatTemplates (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildCatThreadPool (opts) {
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/
return function catThreadPool (params, callback) {
return function catThreadPool (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
catThreadPool(params, (err, body) => {
catThreadPool(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -98,7 +104,7 @@ function buildCatThreadPool (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildCatThreadPool (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -8,15 +8,21 @@ function buildCcrDeleteAutoFollowPattern (opts) {
*
* @param {string} name - The name of the auto follow pattern.
*/
return function ccrDeleteAutoFollowPattern (params, callback) {
return function ccrDeleteAutoFollowPattern (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrDeleteAutoFollowPattern(params, (err, body) => {
ccrDeleteAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -66,7 +72,7 @@ function buildCcrDeleteAutoFollowPattern (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -78,12 +84,17 @@ function buildCcrDeleteAutoFollowPattern (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildCcrFollow (opts) {
* @param {string} index - The name of the follower index
* @param {object} body - The name of the leader index and other optional ccr related parameters
*/
return function ccrFollow (params, callback) {
return function ccrFollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrFollow(params, (err, body) => {
ccrFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildCcrFollow (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildCcrFollow (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -8,15 +8,21 @@ function buildCcrFollowStats (opts) {
*
* @param {list} index - A comma-separated list of index patterns; use `_all` to perform the operation on all indices
*/
return function ccrFollowStats (params, callback) {
return function ccrFollowStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrFollowStats(params, (err, body) => {
ccrFollowStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -58,7 +64,7 @@ function buildCcrFollowStats (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -70,12 +76,17 @@ function buildCcrFollowStats (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -8,15 +8,21 @@ function buildCcrGetAutoFollowPattern (opts) {
*
* @param {string} name - The name of the auto follow pattern.
*/
return function ccrGetAutoFollowPattern (params, callback) {
return function ccrGetAutoFollowPattern (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrGetAutoFollowPattern(params, (err, body) => {
ccrGetAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -58,7 +64,7 @@ function buildCcrGetAutoFollowPattern (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -70,12 +76,17 @@ function buildCcrGetAutoFollowPattern (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -8,15 +8,21 @@ function buildCcrPauseFollow (opts) {
*
* @param {string} index - The name of the follower index that should pause following its leader index.
*/
return function ccrPauseFollow (params, callback) {
return function ccrPauseFollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrPauseFollow(params, (err, body) => {
ccrPauseFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -66,7 +72,7 @@ function buildCcrPauseFollow (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -78,12 +84,17 @@ function buildCcrPauseFollow (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildCcrPutAutoFollowPattern (opts) {
* @param {string} name - The name of the auto follow pattern.
* @param {object} body - The specification of the auto follow pattern
*/
return function ccrPutAutoFollowPattern (params, callback) {
return function ccrPutAutoFollowPattern (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrPutAutoFollowPattern(params, (err, body) => {
ccrPutAutoFollowPattern(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildCcrPutAutoFollowPattern (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildCcrPutAutoFollowPattern (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildCcrResumeFollow (opts) {
* @param {string} index - The name of the follow index to resume following.
* @param {object} body - The name of the leader index and other optional ccr related parameters
*/
return function ccrResumeFollow (params, callback) {
return function ccrResumeFollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrResumeFollow(params, (err, body) => {
ccrResumeFollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildCcrResumeFollow (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildCcrResumeFollow (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -7,15 +7,21 @@ function buildCcrStats (opts) {
* Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request
*
*/
return function ccrStats (params, callback) {
return function ccrStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrStats(params, (err, body) => {
ccrStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -57,7 +63,7 @@ function buildCcrStats (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -69,12 +75,17 @@ function buildCcrStats (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -8,15 +8,21 @@ function buildCcrUnfollow (opts) {
*
* @param {string} index - The name of the follower index that should be turned into a regular index.
*/
return function ccrUnfollow (params, callback) {
return function ccrUnfollow (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ccrUnfollow(params, (err, body) => {
ccrUnfollow(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -66,7 +72,7 @@ function buildCcrUnfollow (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -78,12 +84,17 @@ function buildCcrUnfollow (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildClearScroll (opts) {
* @param {list} scroll_id - A comma-separated list of scroll IDs to clear
* @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
*/
return function clearScroll (params, callback) {
return function clearScroll (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clearScroll(params, (err, body) => {
clearScroll(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -67,7 +73,7 @@ function buildClearScroll (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -79,12 +85,17 @@ function buildClearScroll (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildClusterAllocationExplain (opts) {
* @param {boolean} include_disk_info - Return information about disk usage and shard sizes (default: false)
* @param {object} body - The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'
*/
return function clusterAllocationExplain (params, callback) {
return function clusterAllocationExplain (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterAllocationExplain(params, (err, body) => {
clusterAllocationExplain(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -72,7 +78,7 @@ function buildClusterAllocationExplain (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -84,12 +90,17 @@ function buildClusterAllocationExplain (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildClusterGetSettings (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {boolean} include_defaults - Whether to return all default clusters setting.
*/
return function clusterGetSettings (params, callback) {
return function clusterGetSettings (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterGetSettings(params, (err, body) => {
clusterGetSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -85,7 +91,7 @@ function buildClusterGetSettings (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -97,12 +103,17 @@ function buildClusterGetSettings (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -18,15 +18,21 @@ function buildClusterHealth (opts) {
* @param {boolean} wait_for_no_initializing_shards - Whether to wait until there are no initializing shards in the cluster
* @param {enum} wait_for_status - Wait until cluster is in a specific state
*/
return function clusterHealth (params, callback) {
return function clusterHealth (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterHealth(params, (err, body) => {
clusterHealth(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -104,7 +110,7 @@ function buildClusterHealth (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -116,12 +122,17 @@ function buildClusterHealth (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildClusterPendingTasks (opts) {
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function clusterPendingTasks (params, callback) {
return function clusterPendingTasks (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterPendingTasks(params, (err, body) => {
clusterPendingTasks(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -79,7 +85,7 @@ function buildClusterPendingTasks (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -91,12 +97,17 @@ function buildClusterPendingTasks (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildClusterPutSettings (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {object} body - The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).
*/
return function clusterPutSettings (params, callback) {
return function clusterPutSettings (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterPutSettings(params, (err, body) => {
clusterPutSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildClusterPutSettings (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildClusterPutSettings (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -7,15 +7,21 @@ function buildClusterRemoteInfo (opts) {
* Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request
*
*/
return function clusterRemoteInfo (params, callback) {
return function clusterRemoteInfo (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterRemoteInfo(params, (err, body) => {
clusterRemoteInfo(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildClusterRemoteInfo (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildClusterRemoteInfo (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildClusterReroute (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {object} body - The definition of `commands` to perform (`move`, `cancel`, `allocate`)
*/
return function clusterReroute (params, callback) {
return function clusterReroute (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterReroute(params, (err, body) => {
clusterReroute(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -84,7 +90,7 @@ function buildClusterReroute (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -96,12 +102,17 @@ function buildClusterReroute (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildClusterState (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function clusterState (params, callback) {
return function clusterState (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterState(params, (err, body) => {
clusterState(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -101,7 +107,7 @@ function buildClusterState (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -113,12 +119,17 @@ function buildClusterState (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildClusterStats (opts) {
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {time} timeout - Explicit operation timeout
*/
return function clusterStats (params, callback) {
return function clusterStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
clusterStats(params, (err, body) => {
clusterStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -80,7 +86,7 @@ function buildClusterStats (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -94,12 +100,17 @@ function buildClusterStats (opts) {
: '/_cluster/stats',
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -23,15 +23,21 @@ function buildCount (opts) {
* @param {number} terminate_after - The maximum count for each shard, upon reaching which the query execution will terminate early
* @param {object} body - A query to restrict the results specified with the Query DSL (optional)
*/
return function count (params, callback) {
return function count (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
count(params, (err, body) => {
count(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -115,7 +121,7 @@ function buildCount (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -127,12 +133,17 @@ function buildCount (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -19,15 +19,21 @@ function buildCreate (opts) {
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The document
*/
return function create (params, callback) {
return function create (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
create(params, (err, body) => {
create(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -132,7 +138,7 @@ function buildCreate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -144,12 +150,17 @@ function buildCreate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -17,15 +17,21 @@ function buildDelete (opts) {
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
return function _delete (params, callback) {
return function _delete (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
_delete(params, (err, body) => {
_delete(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -128,7 +134,7 @@ function buildDelete (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -140,12 +146,17 @@ function buildDelete (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -42,15 +42,21 @@ function buildDeleteByQuery (opts) {
* @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
* @param {object} body - The search definition using the Query DSL
*/
return function deleteByQuery (params, callback) {
return function deleteByQuery (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteByQuery(params, (err, body) => {
deleteByQuery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -186,7 +192,7 @@ function buildDeleteByQuery (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -198,12 +204,17 @@ function buildDeleteByQuery (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildDeleteByQueryRethrottle (opts) {
* @param {string} task_id - The task id to rethrottle
* @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
*/
return function deleteByQueryRethrottle (params, callback) {
return function deleteByQueryRethrottle (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteByQueryRethrottle(params, (err, body) => {
deleteByQueryRethrottle(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -89,7 +95,7 @@ function buildDeleteByQueryRethrottle (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -101,12 +107,17 @@ function buildDeleteByQueryRethrottle (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildDeleteScript (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function deleteScript (params, callback) {
return function deleteScript (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
deleteScript(params, (err, body) => {
deleteScript(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -86,7 +92,7 @@ function buildDeleteScript (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -98,12 +104,17 @@ function buildDeleteScript (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -21,15 +21,21 @@ function buildExists (opts) {
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
return function exists (params, callback) {
return function exists (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
exists(params, (err, body) => {
exists(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -140,7 +146,7 @@ function buildExists (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -152,12 +158,17 @@ function buildExists (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -20,15 +20,21 @@ function buildExistsSource (opts) {
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
return function existsSource (params, callback) {
return function existsSource (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
existsSource(params, (err, body) => {
existsSource(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -137,7 +143,7 @@ function buildExistsSource (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -149,12 +155,17 @@ function buildExistsSource (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -24,15 +24,21 @@ function buildExplain (opts) {
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {object} body - The query definition using the Query DSL
*/
return function explain (params, callback) {
return function explain (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
explain(params, (err, body) => {
explain(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -141,7 +147,7 @@ function buildExplain (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -153,12 +159,17 @@ function buildExplain (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildFieldCaps (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {object} body - Field json objects containing an array of field names
*/
return function fieldCaps (params, callback) {
return function fieldCaps (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
fieldCaps(params, (err, body) => {
fieldCaps(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -79,7 +85,7 @@ function buildFieldCaps (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -91,12 +97,17 @@ function buildFieldCaps (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -21,15 +21,21 @@ function buildGet (opts) {
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
return function get (params, callback) {
return function get (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
get(params, (err, body) => {
get(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -140,7 +146,7 @@ function buildGet (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -152,12 +158,17 @@ function buildGet (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildGetScript (opts) {
* @param {string} id - Script ID
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function getScript (params, callback) {
return function getScript (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
getScript(params, (err, body) => {
getScript(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildGetScript (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildGetScript (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -20,15 +20,21 @@ function buildGetSource (opts) {
* @param {number} version - Explicit version number for concurrency control
* @param {enum} version_type - Specific version type
*/
return function getSource (params, callback) {
return function getSource (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
getSource(params, (err, body) => {
getSource(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -137,7 +143,7 @@ function buildGetSource (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -149,12 +155,17 @@ function buildGetSource (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -20,15 +20,21 @@ function buildIndex (opts) {
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The document
*/
return function index (params, callback) {
return function index (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
index(params, (err, body) => {
index(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -129,7 +135,7 @@ function buildIndex (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -141,12 +147,17 @@ function buildIndex (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIndicesAnalyze (opts) {
* @param {string} index - The name of the index to scope the operation
* @param {object} body - Define analyzer/tokenizer parameters and the text on which the analysis should be performed
*/
return function indicesAnalyze (params, callback) {
return function indicesAnalyze (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesAnalyze(params, (err, body) => {
indicesAnalyze(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -70,7 +76,7 @@ function buildIndicesAnalyze (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -82,12 +88,17 @@ function buildIndicesAnalyze (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -18,15 +18,21 @@ function buildIndicesClearCache (opts) {
* @param {boolean} request_cache - Clear request cache
* @param {boolean} request - Clear request cache
*/
return function indicesClearCache (params, callback) {
return function indicesClearCache (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesClearCache(params, (err, body) => {
indicesClearCache(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -104,7 +110,7 @@ function buildIndicesClearCache (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -116,12 +122,17 @@ function buildIndicesClearCache (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesClose (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesClose (params, callback) {
return function indicesClose (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesClose(params, (err, body) => {
indicesClose(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildIndicesClose (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildIndicesClose (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesCreate (opts) {
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The configuration for the index (`settings` and `mappings`)
*/
return function indicesCreate (params, callback) {
return function indicesCreate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesCreate(params, (err, body) => {
indicesCreate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -87,7 +93,7 @@ function buildIndicesCreate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -99,12 +105,17 @@ function buildIndicesCreate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesDelete (opts) {
* @param {boolean} allow_no_indices - Ignore if a wildcard expression resolves to no concrete indices (default: false)
* @param {enum} expand_wildcards - Whether wildcard expressions should get expanded to open or closed indices (default: open)
*/
return function indicesDelete (params, callback) {
return function indicesDelete (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDelete(params, (err, body) => {
indicesDelete(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -95,7 +101,7 @@ function buildIndicesDelete (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -107,12 +113,17 @@ function buildIndicesDelete (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesDeleteAlias (opts) {
* @param {time} timeout - Explicit timestamp for the document
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function indicesDeleteAlias (params, callback) {
return function indicesDeleteAlias (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDeleteAlias(params, (err, body) => {
indicesDeleteAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -101,7 +107,7 @@ function buildIndicesDeleteAlias (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -115,12 +121,17 @@ function buildIndicesDeleteAlias (opts) {
: '/{index}/_alias/{name}',
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIndicesDeleteTemplate (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function indicesDeleteTemplate (params, callback) {
return function indicesDeleteTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesDeleteTemplate(params, (err, body) => {
indicesDeleteTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -86,7 +92,7 @@ function buildIndicesDeleteTemplate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -98,12 +104,17 @@ function buildIndicesDeleteTemplate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesExists (opts) {
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {boolean} include_defaults - Whether to return all default setting for each of the indices.
*/
return function indicesExists (params, callback) {
return function indicesExists (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExists(params, (err, body) => {
indicesExists(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -98,7 +104,7 @@ function buildIndicesExists (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildIndicesExists (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesExistsAlias (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesExistsAlias (params, callback) {
return function indicesExistsAlias (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsAlias(params, (err, body) => {
indicesExistsAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -93,7 +99,7 @@ function buildIndicesExistsAlias (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -105,12 +111,17 @@ function buildIndicesExistsAlias (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesExistsTemplate (opts) {
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesExistsTemplate (params, callback) {
return function indicesExistsTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsTemplate(params, (err, body) => {
indicesExistsTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -89,7 +95,7 @@ function buildIndicesExistsTemplate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -101,12 +107,17 @@ function buildIndicesExistsTemplate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesExistsType (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesExistsType (params, callback) {
return function indicesExistsType (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesExistsType(params, (err, body) => {
indicesExistsType(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -107,7 +113,7 @@ function buildIndicesExistsType (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -119,12 +125,17 @@ function buildIndicesExistsType (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesFlush (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesFlush (params, callback) {
return function indicesFlush (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesFlush(params, (err, body) => {
indicesFlush(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -89,7 +95,7 @@ function buildIndicesFlush (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -101,12 +107,17 @@ function buildIndicesFlush (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesFlushSynced (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesFlushSynced (params, callback) {
return function indicesFlushSynced (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesFlushSynced(params, (err, body) => {
indicesFlushSynced(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildIndicesFlushSynced (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildIndicesFlushSynced (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesForcemerge (opts) {
* @param {number} max_num_segments - The number of segments the index should be merged into (default: dynamic)
* @param {boolean} only_expunge_deletes - Specify whether the operation should only expunge deleted documents
*/
return function indicesForcemerge (params, callback) {
return function indicesForcemerge (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesForcemerge(params, (err, body) => {
indicesForcemerge(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -92,7 +98,7 @@ function buildIndicesForcemerge (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -104,12 +110,17 @@ function buildIndicesForcemerge (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildIndicesGet (opts) {
* @param {boolean} include_defaults - Whether to return all default setting for each of the indices.
* @param {time} master_timeout - Specify timeout for connection to master
*/
return function indicesGet (params, callback) {
return function indicesGet (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGet(params, (err, body) => {
indicesGet(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -101,7 +107,7 @@ function buildIndicesGet (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -113,12 +119,17 @@ function buildIndicesGet (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesGetAlias (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesGetAlias (params, callback) {
return function indicesGetAlias (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetAlias(params, (err, body) => {
indicesGetAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -87,7 +93,7 @@ function buildIndicesGetAlias (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -99,12 +105,17 @@ function buildIndicesGetAlias (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildIndicesGetFieldMapping (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesGetFieldMapping (params, callback) {
return function indicesGetFieldMapping (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetFieldMapping(params, (err, body) => {
indicesGetFieldMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -97,7 +103,7 @@ function buildIndicesGetFieldMapping (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -109,12 +115,17 @@ function buildIndicesGetFieldMapping (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesGetMapping (opts) {
* @param {time} master_timeout - Specify timeout for connection to master
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesGetMapping (params, callback) {
return function indicesGetMapping (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetMapping(params, (err, body) => {
indicesGetMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -90,7 +96,7 @@ function buildIndicesGetMapping (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -102,12 +108,17 @@ function buildIndicesGetMapping (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildIndicesGetSettings (opts) {
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {boolean} include_defaults - Whether to return all default setting for each of the indices.
*/
return function indicesGetSettings (params, callback) {
return function indicesGetSettings (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetSettings(params, (err, body) => {
indicesGetSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesGetSettings (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -108,12 +114,17 @@ function buildIndicesGetSettings (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesGetTemplate (opts) {
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
*/
return function indicesGetTemplate (params, callback) {
return function indicesGetTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetTemplate(params, (err, body) => {
indicesGetTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildIndicesGetTemplate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildIndicesGetTemplate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesGetUpgrade (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesGetUpgrade (params, callback) {
return function indicesGetUpgrade (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesGetUpgrade(params, (err, body) => {
indicesGetUpgrade(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildIndicesGetUpgrade (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildIndicesGetUpgrade (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesOpen (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns.
*/
return function indicesOpen (params, callback) {
return function indicesOpen (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesOpen(params, (err, body) => {
indicesOpen(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -98,7 +104,7 @@ function buildIndicesOpen (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildIndicesOpen (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -12,15 +12,21 @@ function buildIndicesPutAlias (opts) {
* @param {time} master_timeout - Specify timeout for connection to master
* @param {object} body - The settings for the alias, such as `routing` or `filter`
*/
return function indicesPutAlias (params, callback) {
return function indicesPutAlias (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutAlias(params, (err, body) => {
indicesPutAlias(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesPutAlias (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -110,12 +116,17 @@ function buildIndicesPutAlias (opts) {
: '/{index}/_alias/{name}',
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildIndicesPutMapping (opts) {
* @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not
* @param {object} body - The mapping definition
*/
return function indicesPutMapping (params, callback) {
return function indicesPutMapping (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutMapping(params, (err, body) => {
indicesPutMapping(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -100,7 +106,7 @@ function buildIndicesPutMapping (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -112,12 +118,17 @@ function buildIndicesPutMapping (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildIndicesPutSettings (opts) {
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {object} body - The index settings to be updated
*/
return function indicesPutSettings (params, callback) {
return function indicesPutSettings (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutSettings(params, (err, body) => {
indicesPutSettings(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesPutSettings (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -108,12 +114,17 @@ function buildIndicesPutSettings (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesPutTemplate (opts) {
* @param {boolean} flat_settings - Return settings in flat format (default: false)
* @param {object} body - The template definition
*/
return function indicesPutTemplate (params, callback) {
return function indicesPutTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesPutTemplate(params, (err, body) => {
indicesPutTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesPutTemplate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -108,12 +114,17 @@ function buildIndicesPutTemplate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIndicesRecovery (opts) {
* @param {boolean} detailed - Whether to display detailed information about shard recovery
* @param {boolean} active_only - Display only those recoveries that are currently on-going
*/
return function indicesRecovery (params, callback) {
return function indicesRecovery (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRecovery(params, (err, body) => {
indicesRecovery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -80,7 +86,7 @@ function buildIndicesRecovery (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -92,12 +98,17 @@ function buildIndicesRecovery (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIndicesRefresh (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesRefresh (params, callback) {
return function indicesRefresh (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRefresh(params, (err, body) => {
indicesRefresh(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -83,7 +89,7 @@ function buildIndicesRefresh (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -95,12 +101,17 @@ function buildIndicesRefresh (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesRollover (opts) {
* @param {string} wait_for_active_shards - Set the number of active shards to wait for on the newly created rollover index before the operation returns.
* @param {object} body - The conditions that needs to be met for executing rollover
*/
return function indicesRollover (params, callback) {
return function indicesRollover (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesRollover(params, (err, body) => {
indicesRollover(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesRollover (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -108,12 +114,17 @@ function buildIndicesRollover (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -12,15 +12,21 @@ function buildIndicesSegments (opts) {
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {boolean} verbose - Includes detailed memory usage by Lucene.
*/
return function indicesSegments (params, callback) {
return function indicesSegments (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesSegments(params, (err, body) => {
indicesSegments(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -86,7 +92,7 @@ function buildIndicesSegments (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -98,12 +104,17 @@ function buildIndicesSegments (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -12,15 +12,21 @@ function buildIndicesShardStores (opts) {
* @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)
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
*/
return function indicesShardStores (params, callback) {
return function indicesShardStores (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesShardStores(params, (err, body) => {
indicesShardStores(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -86,7 +92,7 @@ function buildIndicesShardStores (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -98,12 +104,17 @@ function buildIndicesShardStores (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesShrink (opts) {
* @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns.
* @param {object} body - The configuration for the target index (`settings` and `aliases`)
*/
return function indicesShrink (params, callback) {
return function indicesShrink (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesShrink(params, (err, body) => {
indicesShrink(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -102,7 +108,7 @@ function buildIndicesShrink (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -114,12 +120,17 @@ function buildIndicesShrink (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -14,15 +14,21 @@ function buildIndicesSplit (opts) {
* @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns.
* @param {object} body - The configuration for the target index (`settings` and `aliases`)
*/
return function indicesSplit (params, callback) {
return function indicesSplit (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesSplit(params, (err, body) => {
indicesSplit(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -102,7 +108,7 @@ function buildIndicesSplit (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -114,12 +120,17 @@ function buildIndicesSplit (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -16,15 +16,21 @@ function buildIndicesStats (opts) {
* @param {list} types - A comma-separated list of document types for the `indexing` index metric
* @param {boolean} include_segment_file_sizes - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
*/
return function indicesStats (params, callback) {
return function indicesStats (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesStats(params, (err, body) => {
indicesStats(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -96,7 +102,7 @@ function buildIndicesStats (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -108,12 +114,17 @@ function buildIndicesStats (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIndicesUpdateAliases (opts) {
* @param {time} master_timeout - Specify timeout for connection to master
* @param {object} body - The definition of `actions` to perform
*/
return function indicesUpdateAliases (params, callback) {
return function indicesUpdateAliases (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesUpdateAliases(params, (err, body) => {
indicesUpdateAliases(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -80,7 +86,7 @@ function buildIndicesUpdateAliases (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -92,12 +98,17 @@ function buildIndicesUpdateAliases (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildIndicesUpgrade (opts) {
* @param {boolean} wait_for_completion - Specify whether the request should block until the all segments are upgraded (default: false)
* @param {boolean} only_ancient_segments - If true, only ancient (an older Lucene major release) segments will be upgraded
*/
return function indicesUpgrade (params, callback) {
return function indicesUpgrade (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesUpgrade(params, (err, body) => {
indicesUpgrade(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -89,7 +95,7 @@ function buildIndicesUpgrade (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -101,12 +107,17 @@ function buildIndicesUpgrade (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -22,15 +22,21 @@ function buildIndicesValidateQuery (opts) {
* @param {boolean} all_shards - Execute validation on all shards instead of one random shard per index
* @param {object} body - The query definition specified with the Query DSL
*/
return function indicesValidateQuery (params, callback) {
return function indicesValidateQuery (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
indicesValidateQuery(params, (err, body) => {
indicesValidateQuery(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -112,7 +118,7 @@ function buildIndicesValidateQuery (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -124,12 +130,17 @@ function buildIndicesValidateQuery (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -7,15 +7,21 @@ function buildInfo (opts) {
* Perform a [info](http://www.elastic.co/guide/) request
*
*/
return function info (params, callback) {
return function info (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
info(params, (err, body) => {
info(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildInfo (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildInfo (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIngestDeletePipeline (opts) {
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {time} timeout - Explicit operation timeout
*/
return function ingestDeletePipeline (params, callback) {
return function ingestDeletePipeline (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ingestDeletePipeline(params, (err, body) => {
ingestDeletePipeline(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -86,7 +92,7 @@ function buildIngestDeletePipeline (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -98,12 +104,17 @@ function buildIngestDeletePipeline (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -9,15 +9,21 @@ function buildIngestGetPipeline (opts) {
* @param {string} id - Comma separated list of pipeline ids. Wildcards supported
* @param {time} master_timeout - Explicit operation timeout for connection to master node
*/
return function ingestGetPipeline (params, callback) {
return function ingestGetPipeline (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ingestGetPipeline(params, (err, body) => {
ingestGetPipeline(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -77,7 +83,7 @@ function buildIngestGetPipeline (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -89,12 +95,17 @@ function buildIngestGetPipeline (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -7,15 +7,21 @@ function buildIngestProcessorGrok (opts) {
* Perform a [ingest.processor_grok](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request
*
*/
return function ingestProcessorGrok (params, callback) {
return function ingestProcessorGrok (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ingestProcessorGrok(params, (err, body) => {
ingestProcessorGrok(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -73,7 +79,7 @@ function buildIngestProcessorGrok (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -85,12 +91,17 @@ function buildIngestProcessorGrok (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: null,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -11,15 +11,21 @@ function buildIngestPutPipeline (opts) {
* @param {time} timeout - Explicit operation timeout
* @param {object} body - The ingest definition
*/
return function ingestPutPipeline (params, callback) {
return function ingestPutPipeline (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ingestPutPipeline(params, (err, body) => {
ingestPutPipeline(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -87,7 +93,7 @@ function buildIngestPutPipeline (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -99,12 +105,17 @@ function buildIngestPutPipeline (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -10,15 +10,21 @@ function buildIngestSimulate (opts) {
* @param {boolean} verbose - Verbose mode. Display data output for each processor in executed pipeline
* @param {object} body - The simulate definition
*/
return function ingestSimulate (params, callback) {
return function ingestSimulate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
ingestSimulate(params, (err, body) => {
ingestSimulate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -78,7 +84,7 @@ function buildIngestSimulate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -90,12 +96,17 @@ function buildIngestSimulate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -18,15 +18,21 @@ function buildMget (opts) {
* @param {list} _source_include - A list of fields to extract and return from the _source field
* @param {object} body - Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL.
*/
return function mget (params, callback) {
return function mget (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
mget(params, (err, body) => {
mget(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -108,7 +114,7 @@ function buildMget (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -120,12 +126,17 @@ function buildMget (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
body: params.body || '',
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -15,15 +15,21 @@ function buildMsearch (opts) {
* @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
* @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines
*/
return function msearch (params, callback) {
return function msearch (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
msearch(params, (err, body) => {
msearch(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -99,7 +105,7 @@ function buildMsearch (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -111,12 +117,17 @@ function buildMsearch (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
bulkBody: params.body,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

View File

@ -13,15 +13,21 @@ function buildMsearchTemplate (opts) {
* @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute
* @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines
*/
return function msearchTemplate (params, callback) {
return function msearchTemplate (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
callback = options
options = {}
}
if (typeof params === 'function' || params == null) {
callback = params
params = {}
options = {}
}
// promises support
if (callback == null) {
return new Promise((resolve, reject) => {
msearchTemplate(params, (err, body) => {
msearchTemplate(params, options, (err, body) => {
err ? reject(err) : resolve(body)
})
})
@ -93,7 +99,7 @@ function buildMsearchTemplate (opts) {
)
}
var ignore = params.ignore || null
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
@ -105,12 +111,17 @@ function buildMsearchTemplate (opts) {
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
querystring,
bulkBody: params.body,
headers: params.headers || null,
ignore,
requestTimeout: params.requestTimeout || null
headers: params.headers || null
}
return makeRequest(request, callback)
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false
}
return makeRequest(request, requestOptions, callback)
}
}

Some files were not shown because too many files have changed in this diff Show More