【问题标题】:Unrecognized option "mappings" under "fos_elastica.indexes.app.types.user"“fos_elastica.indexes.app.types.user”下无法识别的选项“mappings”
【发布时间】:2019-01-14 10:02:52
【问题描述】:

我使用 symfony 和 fos elastica bundle。我正在尝试添加本教程中的映射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: ~

【问题讨论】:

    标签: symfony elasticsearch elastica


    【解决方案1】:

    fos_elastica 配置中没有“映射”属性。您可以使用以下命令列出所有可能的配置属性:

    php bin/console config:dump-reference fos_elastica
    

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-22
      • 2013-12-19
      • 2016-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-16
      • 2015-04-19
      相关资源
      最近更新 更多