Skip to content

Configuration to allow request_options to be used #880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 5.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions DependencyInjection/Configuration.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
11 changes: 8 additions & 3 deletions Resources/doc/configuration.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ongr_elasticsearch:
max_gram: 20
managers:
default:
index:
index:
hosts:
- 127.0.0.1:9200
index_name: ongr-default
Expand All @@ -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
```
```
1 change: 1 addition & 0 deletions Service/ManagerFactory.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down