[generate/aliases] merge the aliases into a single file
This commit is contained in:
@ -69,6 +69,7 @@
|
||||
"nock": "~0.28.3",
|
||||
"open": "0.0.4",
|
||||
"optimist": "~0.6.0",
|
||||
"semver": "~4.1.0",
|
||||
"sinon": "~1.7.3",
|
||||
"xmlbuilder": "~0.4.3"
|
||||
},
|
||||
|
||||
@ -1,4 +1,70 @@
|
||||
module.exports = {
|
||||
module.exports = [
|
||||
{
|
||||
version: '0.90.x',
|
||||
aliases: {
|
||||
'cluster.nodeHotThreads': [
|
||||
'/_cluster/nodes/hotthreads',
|
||||
'/_cluster/nodes/hot_threads',
|
||||
'/_nodes/hot_threads',
|
||||
'/_cluster/nodes/{node_id}/hotthreads',
|
||||
'/_cluster/nodes/{node_id}/hot_threads',
|
||||
'/_nodes/{node_id}/hot_threads'
|
||||
],
|
||||
'cluster.nodeInfo': [
|
||||
'/_cluster/nodes',
|
||||
'/_nodes/settings',
|
||||
'/_nodes/os',
|
||||
'/_nodes/process',
|
||||
'/_nodes/jvm',
|
||||
'/_nodes/thread_pool',
|
||||
'/_nodes/network',
|
||||
'/_nodes/transport',
|
||||
'/_nodes/http',
|
||||
'/_nodes/plugin',
|
||||
'/_cluster/nodes/{node_id}',
|
||||
'/_nodes/{node_id}/settings',
|
||||
'/_nodes/{node_id}/os',
|
||||
'/_nodes/{node_id}/process',
|
||||
'/_nodes/{node_id}/jvm',
|
||||
'/_nodes/{node_id}/thread_pool',
|
||||
'/_nodes/{node_id}/network',
|
||||
'/_nodes/{node_id}/transport',
|
||||
'/_nodes/{node_id}/http',
|
||||
'/_nodes/{node_id}/plugin'
|
||||
],
|
||||
'cluster.nodeShutdown': [
|
||||
'/_cluster/nodes/_shutdown'
|
||||
],
|
||||
'cluster.nodeStats': [
|
||||
'/_cluster/nodes/stats',
|
||||
'/_nodes/stats/{metric_family}',
|
||||
'/_nodes/stats/indices/{metric}/{fields}',
|
||||
'/_cluster/nodes/{node_id}/stats',
|
||||
'/_nodes/{node_id}/stats/{metric_family}',
|
||||
'/_nodes/{node_id}/stats/indices/{metric}/{fields}'
|
||||
],
|
||||
'get': [
|
||||
'/{index}/{type}/{id}/_source'
|
||||
],
|
||||
'indices.deleteMapping': [
|
||||
'/{index}/{type}/_mapping'
|
||||
],
|
||||
'indices.stats': [
|
||||
'_stats/{metric_family}',
|
||||
'/_stats/indexing',
|
||||
'/_stats/indexing/{indexing_types}',
|
||||
'/_stats/search/{search_groups}',
|
||||
'/_stats/fielddata/{fields}',
|
||||
'/{index}/_stats/{metric_family}',
|
||||
'/{index}/_stats/indexing',
|
||||
'/{index}/_stats/search/{search_groups}',
|
||||
'/{index}/_stats/fielddata/{fields}'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
version: '>=1.0.0',
|
||||
aliases: {
|
||||
'nodes.hotThreads': [
|
||||
'/_cluster/nodes/hotthreads',
|
||||
'/_cluster/nodes/hot_threads',
|
||||
@ -95,4 +161,6 @@ module.exports = {
|
||||
'snapshot.create': [
|
||||
'/_snapshot/{repository}/{snapshot}/_create'
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -1,60 +0,0 @@
|
||||
module.exports = {
|
||||
'cluster.nodeHotThreads': [
|
||||
'/_cluster/nodes/hotthreads',
|
||||
'/_cluster/nodes/hot_threads',
|
||||
'/_nodes/hot_threads',
|
||||
'/_cluster/nodes/{node_id}/hotthreads',
|
||||
'/_cluster/nodes/{node_id}/hot_threads',
|
||||
'/_nodes/{node_id}/hot_threads'
|
||||
],
|
||||
'cluster.nodeInfo': [
|
||||
'/_cluster/nodes',
|
||||
'/_nodes/settings',
|
||||
'/_nodes/os',
|
||||
'/_nodes/process',
|
||||
'/_nodes/jvm',
|
||||
'/_nodes/thread_pool',
|
||||
'/_nodes/network',
|
||||
'/_nodes/transport',
|
||||
'/_nodes/http',
|
||||
'/_nodes/plugin',
|
||||
'/_cluster/nodes/{node_id}',
|
||||
'/_nodes/{node_id}/settings',
|
||||
'/_nodes/{node_id}/os',
|
||||
'/_nodes/{node_id}/process',
|
||||
'/_nodes/{node_id}/jvm',
|
||||
'/_nodes/{node_id}/thread_pool',
|
||||
'/_nodes/{node_id}/network',
|
||||
'/_nodes/{node_id}/transport',
|
||||
'/_nodes/{node_id}/http',
|
||||
'/_nodes/{node_id}/plugin'
|
||||
],
|
||||
'cluster.nodeShutdown': [
|
||||
'/_cluster/nodes/_shutdown'
|
||||
],
|
||||
'cluster.nodeStats': [
|
||||
'/_cluster/nodes/stats',
|
||||
'/_nodes/stats/{metric_family}',
|
||||
'/_nodes/stats/indices/{metric}/{fields}',
|
||||
'/_cluster/nodes/{node_id}/stats',
|
||||
'/_nodes/{node_id}/stats/{metric_family}',
|
||||
'/_nodes/{node_id}/stats/indices/{metric}/{fields}'
|
||||
],
|
||||
'get': [
|
||||
'/{index}/{type}/{id}/_source'
|
||||
],
|
||||
'indices.deleteMapping': [
|
||||
'/{index}/{type}/_mapping'
|
||||
],
|
||||
'indices.stats': [
|
||||
'_stats/{metric_family}',
|
||||
'/_stats/indexing',
|
||||
'/_stats/indexing/{indexing_types}',
|
||||
'/_stats/search/{search_groups}',
|
||||
'/_stats/fielddata/{fields}',
|
||||
'/{index}/_stats/{metric_family}',
|
||||
'/{index}/_stats/indexing',
|
||||
'/{index}/_stats/search/{search_groups}',
|
||||
'/{index}/_stats/fielddata/{fields}'
|
||||
]
|
||||
};
|
||||
@ -9,6 +9,7 @@ module.exports = function (branch, done) {
|
||||
var async = require('async');
|
||||
var chalk = require('chalk');
|
||||
var path = require('path');
|
||||
var semver = require('semver');
|
||||
var fromRoot = path.join.bind(path, require('find-root')(__dirname));
|
||||
var templates = require('./templates');
|
||||
var urlParamRE = /\{(\w+)\}/g;
|
||||
@ -18,14 +19,24 @@ module.exports = function (branch, done) {
|
||||
var docVars; // slightly modified clone of apiSpec for the docs
|
||||
|
||||
var branchSuffix = utils.branchSuffix(branch);
|
||||
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';
|
||||
|
||||
throw new Error('unable to convert branch "' + branch + '" to semver');
|
||||
}());
|
||||
|
||||
var esDir = fromRoot('src/_elasticsearch_' + _.snakeCase(branch));
|
||||
var aliases;
|
||||
try {
|
||||
aliases = require('./aliases_' + _.snakeCase(branch));
|
||||
} catch (e) {
|
||||
// fall back to the master aliases
|
||||
aliases = require('./aliases');
|
||||
var aliases = _.transform(require('./aliases'), function (aliases, rule) {
|
||||
if (semver.satisfies(branchAsVersion, rule.version)) {
|
||||
_.assign(aliases, rule.aliases);
|
||||
}
|
||||
}, {});
|
||||
|
||||
var steps = [
|
||||
readSpecFiles,
|
||||
|
||||
Reference in New Issue
Block a user