Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

The notes below are for those who use FOSElasticaBundle in their projects. You'll find an example for each points below in this blog.


Example config

For more information and options available, check Configuration.php.

Bare minimum

driver: orm
model: Your/AppBundle/Entity/User
finder: ~
provider: ~
listener: ~


driver: The driver you are using.
model: The entity class that you want to create an index from.
finder: Used to query ES finder. No need to touch this.
provider: Used to create a custom repository QueryBuilder (query_builder_method) that manually selects records from the DB to populate the index from. Or, we can populate index with the data coming from somewhere else rather than the database by using a custom provider class (service).
listener: Define how do you wish to update elasticsearch index after CRUD operations in DB.
model_to_elastica_transformer: Used to create a custom class which is used to populate/manipulate ES index creation.