diff --git a/src/plugins/elasticsearch/lib/create_proxy.js b/src/plugins/elasticsearch/lib/create_proxy.js index 7bcc1e77756b6..338a7aa3433cc 100644 --- a/src/plugins/elasticsearch/lib/create_proxy.js +++ b/src/plugins/elasticsearch/lib/create_proxy.js @@ -1,12 +1,18 @@ const createAgent = require('./create_agent'); const mapUri = require('./map_uri'); const { resolve } = require('url'); +const { assign } = require('lodash'); function createProxy(server, method, route, config) { const options = { method: method, path: createProxy.createPath(route), + config: { + timeout: { + socket: server.config().get('elasticsearch.requestTimeout') + } + }, handler: { proxy: { mapUri: mapUri(server), @@ -18,7 +24,7 @@ function createProxy(server, method, route, config) { }, }; - if (config) options.config = config; + assign(options.config, config); server.route(options); };