2

In my symfony2 / doctrine 2 application, I get an error when running fos:elastica:populate :

[Elastica\Exception\Bulk\ResponseException]
Error in one or more bulk request actions:
index: /foodmeup/offer/4 caused MapperParsingException[failed to parse [res ponsibilities]]; nested: ElasticsearchIllegalArgumentException[unknown prop erty [0]];

My config is the following, I have set type: string to responsibilities which is actually a doctrine json array:

offer:
    mappings:
        name: { type: string, boost: 10}
        content: { type: string }
        responsibilities: { type: string }
        skills:
            type: "nested"
            properties:
                name: { type: string }
        contractType:
            type: "nested"
            properties:
                name: { type: string }
        position:
            type: "nested"
            properties:
                name: { type: string, boost: 10 }

And my entity mapping :

/**
 * @ORM\Column(type="json_array", nullable=false)
 */
protected $responsibilities = array();

What can I do to resolve this ? I have tried with "~" instead of "string" but the same problem arises and when I just remove the config line for responsibilities, it works well.

Thanks !

Sébastien
  • 5,263
  • 11
  • 55
  • 116
  • maybe because your responsibilities is an array and cannot be configured as string in the mapping , check if there is array type in the bundle – Nawfal Serrar May 27 '15 at 06:13

1 Answers1

2

I think you should use some transformers as your data are not of the same types. I really recommend you to read this article: http://obtao.com/blog/2014/05/advanced-indexing-with-elasticsearch-foselasticabundle/

hanego
  • 1,595
  • 1
  • 14
  • 27