wikibusiness / elastica-bundle
Slim wrapper bundle for Elastica, when FOSElasticaBundle is too much.
Package info
github.com/wikibusiness/elastica-bundle
Type:symfony-bundle
pkg:composer/wikibusiness/elastica-bundle
1.2
2015-04-10 21:19 UTC
Requires
- php: >=5.5
- ruflin/elastica: ~1.3
This package is not auto-updated.
Last update: 2026-02-28 23:56:47 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); ...