Simple Nette extension for creating Elasticsearch Client service
Download extension using composer
composer require ublaboo/elasticsearch-nette-extension
Register extension in your config.neon file:
extensions:
elasticsearch: Ublaboo\Elasticsearch\DI\ElasticsearchExtension
Configure extension in your config.neon
file:
elasticsearch:
hosts:
- 127.0.0.1:9200
use Elasticsearch;
class MySuperBusinessModelClass
{
/**
* @var Elasticsearch\Client
*/
public $elasticsearchClient;
public function __construct(Elasticsearch\Client $elasticsearchClient)
{
$this->elasticsearchClient = $elasticsearchClient;
}
public function foo(): void
{
/**
* Do something with $this->elasticsearchClient
*/
}
}