首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法识别的选项“类型”- FOS Elastica & Symfony

无法识别的选项“类型”- FOS Elastica & Symfony
EN

Stack Overflow用户
提问于 2022-02-24 11:23:53
回答 1查看 391关注 0票数 0

我能够创建索引1乘1,但我的目的是有一个大索引和子索引进行搜索。(我正在复制一个现有的应用程序,但升级依赖项)

Symfony : 5.4* FOS-Elastica : 6.1弹性: 7*

这是我的错误信息,如果我将类型更改为属性,则会出现类似的错误。我一整天都在尝试以不同的方式切换和缩进:

代码语言:javascript
复制
Unrecognized option "types" under "fos_elastica.indexes.app". Available options are "_id", "_routing", "_source", "analyzer", "client", "date_detection", "dynamic", "dynamic_date_formats", "dynamic_templates", "finder", "index_   
  name", "index_prototype", "indexable_callback", "numeric_detection", "persistence", "properties", "serializer", "settings", "use_alias".   

,请问我做错什么了?

代码语言:javascript
复制
#app/config/config.yml
fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }

    indexes:
        app:
            settings:
                analysis:
                    analyzer:
                        fr:
                            tokenizer: standard
                            filter: [ lowercase, stop_fr, snowball_fr ]
                        autocomplete:
                            type: custom
                            tokenizer: whitespace
                            filter: [ lowercase, engram, elision ]
                        csv:
                            type: pattern
                            pattern: '\s*,\s*'
                            lowercase: false
                    filter:
                        snowball_fr:
                            type: "snowball"
                            language: "French"
                        stop_fr:
                            type: "stop"
                            stopwords: "_french_"
                        engram:
                            type: edge_ngram
                            min_gram: 2
                            max_gram: 15
            types:
                # ---------
                # USER
                # ---------
                user:
                    properties:
                        username: ~
                        email: ~
                        organization:
                            type: object
                            properties:
                                id: { index: true }
                                code: { index: true }
                                name:
                                    index: true
                                    type: text
                                    fields:
                                        source: { type: text, index: true }
                    persistence:
                        driver: orm # orm, mongodb, propel are available
                        model: App\Entity\User
                        provider: ~
                        listener: ~
                        finder: ~
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-02 14:07:20

因此,我也在研究如何处理与您相同的问题,我确实确认了很多文档和博客使用了您发布的配置结构。但是,当我回到这个包的v6.1文档时,我是找到这个

动态模板动态模板允许定义在动态引入字段/对象时应用的映射模板。 文档 fos_elastica: indexes: dynamic_templates: my_template_1: match: apples_*映射: type: float my_template_2: match:*match_mapping_type:文本映射: type:关键字属性:用户名:{ type: text }

因此,在您的示例中,工作配置如下所示:

代码语言:javascript
复制
#app/config/config.yml
fos_elastica:
  clients:
    default: { host: localhost, port: 9200 }

  indexes:
    user:
      settings:
        analysis:
          analyzer:
            fr:
              tokenizer: standard
              filter: [ lowercase, stop_fr, snowball_fr ]
            autocomplete:
              type: custom
              tokenizer: whitespace
              filter: [ lowercase, engram, elision ]
            csv:
              type: pattern
              pattern: '\s*,\s*'
              lowercase: false
          filter:
            snowball_fr:
              type: "snowball"
              language: "French"
            stop_fr:
              type: "stop"
              stopwords: "_french_"
            engram:
              type: edge_ngram
              min_gram: 2
              max_gram: 15
      properties:
        username: ~
        email: ~
        organization:
          type: object
          properties:
            id: { index: true }
            code: { index: true }
            name:
              index: true
              type: text
              fields:
                source: { type: text, index: true }
      persistence:
        driver: orm # orm, mongodb, propel are available
        model: App\Entity\User
        provider: ~
        listener: ~
        finder: ~
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71251196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档