Search code examples
phpsymfonyfoselasticabundle

Symfony3 FOSElasticaBundle doc example not working



I am trying to set up FOSElasticaBundle.
Composer json entry:

"friendsofsymfony/elastica-bundle": "^3.2"

I was following official docs tutorial,
but this line doesn't work:

$finder = $this->container->get('fos_elastica.finder.app.user');

error i get:

You have requested a non-existent service "fos_elastica.index.app.user".

Do you have any idea why ?

Things i checked:

  • AppKernel.php contains 'new FOS\ElasticaBundle\FOSElasticaBundle(),'
  • Profiler under 'Configuration' tab does not show 'FOSElastica' as enabled :(

config.yml:

fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    indexes:
        app:
            types:
                user:
                    mappings:
                        email: ~
                    persistence:
                        # the driver can be orm, mongodb, phpcr or propel
                        # listener and finder are not supported by
                        # propel and should be removed
                        driver: orm
                        model: AppBundle\Entity\User
                        provider: ~
                        listener: ~
                        finder: ~

Thanks in advance for any insights, guys :)


Solution

  • Turns out bundle didn't install properly.

    "minimum-stability": "dev",
    

    in composer.json on fresh installation worked