For my project I need a simple API for inserting documents into ElasticSearch. FOS\ElasticaBundle\Persister\ObjectPersister seems to be the right thing for me, but I see that the service defined with this class is abstract:
<service id="fos_elastica.object_persister" class="FOS\ElasticaBundle\Persister\ObjectPersister" abstract="true">
<argument /> <!-- index -->
<argument /> <!-- model to elastica transformer -->
<argument /> <!-- model -->
<argument /> <!-- properties mapping -->
<argument /> <!-- options -->
</service>
How can I configure it to be able to inject into my services? Perhaps I should change smth in fos_elastica.yaml, which now looks like this:
fos_elastica:
clients:
default:
url: '%env(ELASTICSEARCH_URL)%'
indexes:
categories: ~
Modify your fos_elastica config with:
You may need to modify your doctrine_mongodb configuration:
And you should be able to persist your Category entity with MongoDb object manager.