wikibusiness / elastica-bundle
Slim wrapper bundle for Elastica, when FOSElasticaBundle is too much.
Installs: 1 172
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5
- ruflin/elastica: ~1.3
This package is not auto-updated.
Last update: 2024-11-23 17:32:46 UTC
README
This is a simple Symfony wrapper for elastica. It allows you to configure elastica as a service in Symfony.
Installation
Install is done via composer
:
$ composer require wikibusiness/elastica-bundle
Add the bundle to your kernel:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new WB\ElasticaBundle\WBElasticaBundle(), ); // ... } } // ...
Configure the bundle:
# app/config/config.yml wb_elastica: servers: main: host: 127.0.0.1 port: 9200
Where main
is a grouping.
If you want to use Elastica in cluster mode, the config section should look something like this:
# app/config/config.yml wb_elastica: servers: host_1: host: 127.0.0.1 port: 9200 host_2: host: 127.0.0.1 port: 9201
All done, you can now access the service via the service wb_elastica.client
like this:
use Elastica\Search; $client = $container->get('wb_elastica.client'); $search = new Search($client); ...