繁体   English   中英

fos elasticabundle映射类型“数组”

[英]fos elasticabundle mapping type “array”

我在表/实体“类别”的“标签”列中有一个学说数组。

FOS ElasticaBundle已启动并且正在运行,现在我想在搜索中添加“标签”列。

我找不到有关如何进行设置的任何资源。 这是我尝试过并且想要做的。

  search:
        client: default
        types:
            category:
                mappings:
                    displayName: ~
                    searchRef: ~
                    tags:
                        type: 'array'
                persistence:
                    driver: orm
                    model: SC\ProviderBundle\Entity\Category
                    provider: ~
                    listener: ~
                    finder: ~

我还有其他三种使用映射类型“嵌套”的类型,它们运行起来还不错。 期望的数组没有键,所以我不知道该为属性添加什么。

我收到这个错误

[Elastica\Exception\ResponseException]
 MapperParsingException[mapping [category]]; nested: MapperParsingException[No handler for type [array] declared on field [tags]];

如何使用FOSElasticaBundle在Symfony2中将映射类型“标签”设置为数组,这在任何文档中都在哪里?

答案是

type:
    category:
        mappings:
            tags:
                type: 'string'

如此处所述

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-array-type.html

(工作链接,但如果页面是idk,则为idk,有人可以随时编辑和改进此答案) https://www.elastic.co/guide/zh-cn/elasticsearch/reference/1.4/mapping-array-type.html

我自己遇到了同样的问题。 对于最新版本的elasticsearch(v4),类型必须为“文本”:

type:
    category:
        mappings:
            tags:
                type: 'text'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM