"fos_elastica.indexes.app.types.user" 下无法识别的选项 "mappings"

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

我将 symfony 与 fos elastica 捆绑包一起使用。我正在尝试像本教程中那样添加映射 https://www.codevate.com/blog/14-implementing-search-as-you-type-autocomplete-with-elasticsearch-and-symfony 但是,出现此错误:

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

这是我的配置:

# 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: ~

fos_elastica配置中没有"mappings"属性。您可以使用以下方式列出所有可能的配置属性:

php bin/console config:dump-reference fos_elastica

尝试将 mappings 更改为 properties 并删除上面配置中的空 properties 键。

如果遇到类似错误,请尝试使用配置参考或官方文档:

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