Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 831 Bytes

README.md

File metadata and controls

58 lines (40 loc) · 831 Bytes

elasticsearch

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

}