FOSElasticaBundle icon indicating copy to clipboard operation
FOSElasticaBundle copied to clipboard

How to disable persistence completely

Open benr77 opened this issue 5 years ago • 2 comments

I might be going slightly mad, but I cannot find any simple way to disable the persistence functionality completely.

I have two applications.

App 1 - Uses this bundle to create and populate an index from Doctrine ORM as normal.

fos_elastica:
    indexes:
        people:
            client: default
            types:
                person:
                    properties:
                        id: ~
                        phoneNumber: ~
                    persistence:
                        driver: orm
                        model: App\Messaging\Domain\Model\People\Person
                        finder: ~
                        provider: ~

App 2 - Uses this bundle to query the index (no finders) and manually populate a different, localised entity

fos_elastica:
    indexes:
        people:
            client: default
            types:
                person:
                    properties:
                        id: ~
                        phoneNumber: ~

I'm getting [InvalidArgumentException] No providers were registered for index "people".

How can I completely ignore persistence operations in app 2 ?

Looks like related to #1507

benr77 avatar May 16 '19 11:05 benr77

I've now realised this is only really an issue when running the fos:elastica:populate command.

To get around this, I've patched the command to add an --excluded-indexes option, that allows me to specify which indexes to exclude when populating.

Happy to submit a PR with this addition if needed.

benr77 avatar May 16 '19 13:05 benr77

@benr77 Yes can you please make one ?

manu-sparheld avatar Jun 14 '19 04:06 manu-sparheld