user10567054
user10567054

Reputation:

Unrecognized option "mappings" under "fos_elastica.indexes.app.types.user"

I use symfony with fos elastica bundle. I'm trying add mappings like in this tutorial https://www.codevate.com/blog/14-implementing-search-as-you-type-autocomplete-with-elasticsearch-and-symfony but, got this error:

Unrecognized option "mappings" under "fos_elastica.indexes.app.types.user"

this is my config:

# Read the documentation: https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md
fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
#    indexes:
#        app: ~
    indexes:
        app:
            client: default
            settings:
              index:
                analysis:
                  analyzer:
                    name_analyzer:
                      type: custom
                      tokenizer: standard
                      filter: [standard, lowercase, asciifolding, elision]
            types:
                user:
                    properties:
                        username: ~
#                    mappings:
#                        email: ~
                    mappings:
                      username:
                        type: completion
                        analyzer: name_analyzer
                        search_analyzer: name_analyzer
                        payloads: true
                    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: App\Entity\User
                        provider: ~
                        listener: ~
                        finder: ~

Upvotes: 2

Views: 1933

Answers (1)

MakG
MakG

Reputation: 1274

There is no "mappings" property in fos_elastica configuration. You can list all possible configuration properties using:

php bin/console config:dump-reference fos_elastica

Try to change mappings to properties and remove empty properties key in your config above.

If you encounter similar errors, try to use config reference or official documentation:

https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/v5.0.3/doc/types.md

Upvotes: 4

Related Questions