diff --git a/package.json b/package.json index d2642c2af..448a9cd5c 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,10 @@ "unstable_es_branches": [ "5.x", "master" - ] + ], + "branch_versions": { + "master": "6.0" + } }, "devDependencies": { "@spalger/eslint-config-personal": "^0.4.0", diff --git a/scripts/Version.js b/scripts/Version.js index 7d639e4ec..e7a0624eb 100644 --- a/scripts/Version.js +++ b/scripts/Version.js @@ -1,6 +1,7 @@ var _ = require('lodash'); var pkg = require('../package.json'); var branches = pkg.config.supported_es_branches; +var branchVersions = pkg.config.branch_versions; var semver = require('semver'); var maxMinorVersion = function (majorV) { @@ -18,14 +19,14 @@ function Version(v) { Version.fromBranch = function (branch) { var m; - // master === the highest version number - if (branch === 'master') return new Version('5.0.0'); + var branchVersion = branchVersions[branch]; + var versionString = branchVersion ? branchVersion : branch; // n.m -> n.m.0 - if (m = branch.match(/^\d+\.\d+$/)) return new Version(branch + '.0'); + if (m = versionString.match(/^\d+\.\d+$/)) return new Version(versionString + '.0'); // n.x -> n.(maxVersion + 1).0 - if (m = branch.match(/^(\d+)\.x$/i)) return maxMinorVersion(m[1]).increment('minor'); + if (m = versionString.match(/^(\d+)\.x$/i)) return maxMinorVersion(m[1]).increment('minor'); throw new Error('unable to convert branch "' + branch + '" to semver'); }; diff --git a/src/lib/apis/5_x.js b/src/lib/apis/5_x.js index 2f7445b9e..63a9f4270 100644 --- a/src/lib/apis/5_x.js +++ b/src/lib/apis/5_x.js @@ -11,7 +11,7 @@ var ca = require('../client_action').makeFactoryWithModifier(function (spec) { var namespace = require('../client_action').namespaceFactory; var api = module.exports = {}; -api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', 'tasks']; +api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'remote', 'snapshot', 'tasks']; /** * Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-bulk.html) request @@ -5990,6 +5990,19 @@ api.reindexRethrottle = ca({ method: 'POST' }); +api.remote = namespace(); + +/** + * Perform a [remote.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + */ +api.remote.prototype.info = ca({ + url: { + fmt: '/_remote/info' + } +}); + /** * Perform a [renderSearchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/5.x/search-template.html) request * diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index d9d97b4d7..449fa1a36 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -11,7 +11,7 @@ var ca = require('../client_action').makeFactoryWithModifier(function (spec) { var namespace = require('../client_action').namespaceFactory; var api = module.exports = {}; -api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'snapshot', 'tasks']; +api._namespaces = ['cat', 'cluster', 'indices', 'ingest', 'nodes', 'remote', 'snapshot', 'tasks']; /** * Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request @@ -1206,7 +1206,10 @@ api.clearScroll = ca({ fmt: '/_search/scroll' } ], - paramAsBody: 'scrollId', + paramAsBody: { + param: 'scrollId', + body: 'scroll_id' + }, method: 'DELETE' }); @@ -5679,6 +5682,19 @@ api.reindexRethrottle = ca({ method: 'POST' }); +api.remote = namespace(); + +/** + * Perform a [remote.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + */ +api.remote.prototype.info = ca({ + url: { + fmt: '/_remote/info' + } +}); + /** * Perform a [renderSearchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request * @@ -5732,7 +5748,10 @@ api.scroll = ca({ fmt: '/_search/scroll' } ], - paramAsBody: 'scrollId', + paramAsBody: { + param: 'scrollId', + body: 'scroll_id' + }, method: 'POST' });