kibana-123
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
26 lines (19 loc) • 562 B
JavaScript
import { Cluster } from './cluster';
import { get, set } from 'lodash';
export function createClusters(server) {
const esPlugin = server.plugins.elasticsearch;
esPlugin._clusters = esPlugin._clusters || new Map();
return {
get(name) {
return esPlugin._clusters.get(name);
},
create(name, config) {
const cluster = new Cluster(config);
if (esPlugin._clusters.has(name)) {
throw new Error(`cluster '${name}' already exists`);
}
esPlugin._clusters.set(name, cluster);
return cluster;
}
};
}