03/06/2016 - ELASTICSEARCH, SYMFONY
The notes below are for those who use FOSElasticaBundle in their projects. You'll find an example for each points below in this blog.
provider.query_builder_method
method which is a custom built method in a repository.provider.query_builder_method
option to manually select specific fields in database to populate elasticsearch index. The smaller the index size, the faster the query.@fos_elastica.index.post_index[indexName].post[type]
(use Elastica\Type;
) dependency injection service for elasticsearch processes rather than @fos_elastica.finder.post_index[indexName].post[type]
(use FOS\ElasticaBundle\Finder\TransformedFinder;
) dependency injection service. Using native 'index' option will give you faster result and more options to use while querying the index. In the case of 'finder' option, you might end up using third party libraries like Pagerfanta that adds overhead to process behind the scene while querying the index.listener.[insert|update|delete]
options to 'false' individually or all.persistence.model_to_elastica_transformer
option.provider.service
option.For more information and options available, check Configuration.php.
persistence:
driver: orm
model: Your/AppBundle/Entity/User
finder: ~
provider: ~
listener: ~
persistence:
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.