Download the PHP package headoo/elasticsearch-bundle without Composer
On this page you can find all versions of the php package headoo/elasticsearch-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download headoo/elasticsearch-bundle
More information about headoo/elasticsearch-bundle
Files in headoo/elasticsearch-bundle
Package elasticsearch-bundle
Short Description ElasticSearch Bundle
License MIT
Homepage https://github.com/Headoo/ElasticSearchBundle
Informations about the package elasticsearch-bundle
ElasticSearchBundle
ElasticSearchBundle is a Symfony2/3 Bundle designed for simply use ElasticSearch 5.x with Doctrine 2.x
Installation
Via Composer
or in composer.json file
Register the bundle in app/AppKernel.php
:
Configuration
Configure your connections and mappings in config.yml
:
And we will linked this to a PHP config. You can use what you want. I prefer this instead yml, it's more in a ElasticSearch way.
I give you an example of the elastic.php
.
Example of entity
As you can see you have to create a Transformer for your Entities.
Usage
If auto_event is set, you have nothing to do for creation, update and deletion of your entities.
You can begin to call Elastic with HeadooElasticService and Ruflin. Example in a Controller.
For more information about querying Elastic, look at Ruflin elastica.io
If auto_event is not set, you can listen headoo.elasticsearch.event
like this :
And in your EventListener Class
Command for populate
CAREFULL: You have to set --reset flag on command FIRST TIME you populate a type or all types.
After configuration of your entities, you maybe want make them available on ElasticSearch. You have to use php app/console headoo:elastic:populate
for Symfony 2 or php bin/console headoo:elastic:populate
for Symfony 3. Differents options are available :
- --limit=int : Limit of your collection
- --offset=int : Offset of your collection
- --type=string : Name of your Object (in our example it's YourEntityClassName)
- --threads=int : Number of threads you want to use for. If you use it, limit will not be available, and you have to set a batch.
- --reset : For reset your indexes. BE CAREFULL, all your data will be lost in your Elastic Cluster
- --batch=int : Length of collection per threads. Use this only with threads
Command for exodus
This command check if each document in ElasticSearch, is still linked with an entity in Doctrine. If not, this command will remove the orphan document from ES.
Reminder: Doctrine and ES should always be iso (with option 'auto_event', without that option, it can be a small delay).
If this command find document not linked, ask you why!
- --limit=int : Limit of your collection
- --offset=int : Offset of your collection
- --type=string : Name of your Object (in our example it's YourEntityClassName)
- --batch=int : Length of collection per threads. Use this only with threads
- --dry-run : Just test. Do not Remove any document from ES
- --verbose : Make more verbose the output
Security
If you discover a security vulnerability, please email instead of using the issue tracker. All security vulnerabilities will be promptly addressed.
Standalone Test
How to test
- clone repo :
$ sudo git clone https://github.com/Headoo/ElasticSearchBundle.git
- go into directory :
$ cd ElasticSearchBundle/
- install composer as explained here : https://getcomposer.org/download/
- launch composer update :
$ ./composer.phar update
- launch test :
$ ./vendor/bin/phpunit
License
This Bundle is open-sourced software licensed under the MIT license
All versions of elasticsearch-bundle with dependencies
symfony/framework-bundle Version ~3.4
symfony/console Version ~3.4
symfony/finder Version ~3.4
symfony/validator Version ~3.4
symfony/process Version ~3.4
ruflin/elastica Version ^5.3
doctrine/doctrine-bundle Version ^1.6
doctrine/orm Version ^2.5
doctrine/doctrine-fixtures-bundle Version >=2.3