ublaboo/elasticsearch-nette-extension

This package is abandoned and no longer maintained. The author suggests using the ublaboo/datagrid package instead.

Simple Nette extension for creating Elasticsearch Client service

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

This package is auto-updated.

Last update: 2020-11-16 12:11:00 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
		 */
	}

}