Contributte Elastica
# Content
This extension integrates the ruflin/elastica (opens new window) into Nette Framework. For more information on how to use Elastica read the official documentation (opens new window).
# Setup
$ composer require contributte/elastica
1
register extension
extensions:
elastica: Contributte\Elastica\DI\ElasticaExtension
1
2
2
# Configuration
Define at least one host, this would be minimal possible config.
elastica:
hosts:
es01:
host: localhost
1
2
3
4
2
3
4
Full config
elastica:
debug: %debugMode%
hosts:
es01:
host: null
port: null
username: null
password: null
path: null
url: null
proxy: null
persistent: null
timeout: null
connections: null
roundRobin: null
log: null
retryOnConflict: null
bigintConversion: null
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Extension does not pass any unset values to elastica so elastica defaults just work. Take a look to Elastica docs (opens new window).
# Usage
Extension registers Contributte\Elastica\Client
to DI container.
class YourService
{
/** @var \Contributte\Elastica\Client */
private $elasticaClient;
public function __construct(Contributte\Elastica\Client $elastica)
{
$this->elasticaClient = $elastica;
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# Monolog
You can use monolog to log errors to kibana.
Just register ElasticaHandler in monolog setup.
- Monolog\Handler\ElasticaHandler
Inspired by Filip Procházka (opens new window) package kdyby/ElasticSearch (opens new window).