ublaboo/elasticsearch-nette-extension

Simple Nette extension for creating Elasticsearch Client service

dev-master 2017-05-23 21:01 UTC

README

Simple Nette extension for creating Elasticsearch Client service

Installation

Download extension using composer

composer require ublaboo/elasticsearch-nette-extension

Register extension in your config.neon file:

extensions:
	elasticsearch: Ublaboo\Elasticsearch\DI\ElasticsearchExtension

Configuration

Configure extension in your config.neon file:

elasticsearch:
	hosts:
		- 127.0.0.1:9200

Usage


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
		 */
	}

}