diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php old mode 100644 new mode 100755 index 0883bcad..12c9dc0d --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -117,6 +117,11 @@ private function getManagersNode() ->prototype('scalar') ->end() ->end() + ->arrayNode('client_options') + ->defaultValue([]) + ->info('Sets client params for connection.') + ->prototype('variable')->end() + ->end() ->arrayNode('settings') ->defaultValue( [ diff --git a/Resources/doc/configuration.md b/Resources/doc/configuration.md old mode 100644 new mode 100755 index 16498966..f27112b6 --- a/Resources/doc/configuration.md +++ b/Resources/doc/configuration.md @@ -22,7 +22,7 @@ ongr_elasticsearch: max_gram: 20 managers: default: - index: + index: hosts: - 127.0.0.1:9200 index_name: ongr-default @@ -33,12 +33,17 @@ ongr_elasticsearch: logger: true #default %kernel.debug% mappings: - AcmeBarBundle #Scans all bundle documents + client_options: # http://docs.guzzlephp.org/en/stable/request-options.html + allow_redirects: false + connect_timeout: 5 + timeout: 20 + custom: - index: + index: hosts: - 10.0.0.1:9200 #default 127.0.0.1:9200 index_name: ongr-custom mappings: AcmeBundle: document_dir: Document -``` \ No newline at end of file +``` diff --git a/Service/ManagerFactory.php b/Service/ManagerFactory.php old mode 100644 new mode 100755 index 6b8bbf3f..7e11c0ef --- a/Service/ManagerFactory.php +++ b/Service/ManagerFactory.php @@ -102,6 +102,7 @@ public function createManager($managerName, $connection, $analysis, $managerConf $client = ClientBuilder::create(); $client->setHosts($connection['hosts']); + $client->setConnectionParams(['client' => $connection['client_options']]); $client->setTracer($this->tracer); if ($this->logger && $managerConfig['logger']['enabled']) {