Theodore Enderby Theodore Enderby - 21 days ago 11
YAML Question

fos elasticabundle mapping type "array"

I have a doctrine array in column "tags" in table/entity "category".

FOS ElasticaBundle is up and working, and now I want to add the "tags" column to the search.

I cannot find any resources on how to set this up. Here is what I've tried and would like to do.

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


I have three other types that use mapping type "nested" than run fine. The array expected has no keys, so I don't know what to put down for properties.

I'm getting this error

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


How do I set my mapping type "tags" as an array in Symfony2 using FOSElasticaBundle and where is this in any documentation?

Answer

The answer is

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

as described here

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

( working link, but idk if it's same page, someone feel free to edit and improve this answer ) https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-array-type.html

Comments