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
35 lines (29 loc) • 919 B
JavaScript
module.exports = function (server) {
server.route({
method: 'GET',
path: '/api/timelion/validate/es',
handler: function (request, reply) {
return server.uiSettings().getAll(request).then((uiSettings) => {
var { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
var timefield = uiSettings['timelion:es.timefield'];
var body = {
index: uiSettings['es.default_index'],
fields:timefield
};
callWithRequest(request, 'fieldStats', body).then(function (resp) {
reply({
ok: true,
field: timefield,
min: resp.indices._all.fields[timefield].min_value,
max: resp.indices._all.fields[timefield].max_value
});
}).catch(function (resp) {
reply({
ok: false,
resp: resp
});
});
});
}
});
};