[aliases] add updated aliases for 1.x

This commit is contained in:
Spencer Alger
2014-10-27 23:59:34 -07:00
parent 2641293b6e
commit 1f76feae4d
3 changed files with 28 additions and 22 deletions

View File

@ -162,5 +162,14 @@ module.exports = [
'/_snapshot/{repository}/{snapshot}/_create'
]
}
},
{
version: '>1.4.0',
aliases: {
'indices.putAlias': [
// '/{index}/_alias/{name}',
'/{index}/_aliases/{name}'
]
}
}
];

View File

@ -19,14 +19,21 @@ module.exports = function (branch, done) {
var docVars; // slightly modified clone of apiSpec for the docs
var branchSuffix = utils.branchSuffix(branch);
var maxMinorVersion = (function () {
var branches = require(fromRoot('package.json')).config.supported_es_branches;
var top = branches.map(function (v) { return v + '.0'; }).sort(semver.compare).pop();
return top.split('.')[1];
}());
var branchAsVersion = (function () {
var m;
// master === the highest version number
if (branch === 'master') return '999.999.999';
// n.m -> n.m.0
if (m = branch.match(/^\d+\.\d+$/)) return branch + '.0';
// n.x -> n.0.0
if (m = branch.match(/^(\d+)\.x$/i)) return m[1] + '.0.0';
// n.x -> n.(maxVersion + 1).0
if (m = branch.match(/^(\d+)\.x$/i)) return m[1] + '.' + (+maxMinorVersion + 1) + '.0';
throw new Error('unable to convert branch "' + branch + '" to semver');
}());