diff --git a/routes/validate_es.js b/routes/validate_es.js index 0a237dbdef2fa..16deaa861f1c2 100644 --- a/routes/validate_es.js +++ b/routes/validate_es.js @@ -1,7 +1,3 @@ -var Promise = require('bluebird'); -var elasticsearch = require('elasticsearch'); - - module.exports = function (server) { server.route({ method: 'GET', diff --git a/series_functions/es.js b/series_functions/es.js index c1c90f7896766..5ed363163f614 100644 --- a/series_functions/es.js +++ b/series_functions/es.js @@ -1,7 +1,6 @@ var _ = require('lodash'); var moment = require('moment'); var Datasource = require('../lib/classes/datasource'); -var elasticsearch = require('elasticsearch'); var offset = { request: function (request, offset) { @@ -152,9 +151,7 @@ module.exports = new Datasource('es', { throw new Error('url= is not allowed'); } - var client = new elasticsearch.Client({ - host: config.url, - }); + var client = tlConfig.server.plugins.elasticsearch.client; var body = buildRequest(config, tlConfig); return client.search(body).then(function (resp) {