jonbwhite / elkuent

Elasticsearch ORM for Laravel
7 stars 0 forks source link

Columns passed in as arrays get stored as a string #7

Open jonbwhite opened 9 years ago

jonbwhite commented 9 years ago

Nested fields are getting stored as strings of JSON, when they should be stored with the JSON structure.

jonbwhite commented 9 years ago

@jasonjlock A) Would this be solved by having a mapping? B) If it is, should we still address this for cases where there isn't a mapping?

jonbwhite commented 9 years ago

Okay, the problem I encountered was first laravel sent a field that was an array as serialized JSON, since it was the first time on a new index/type, it auto mapped to string, and future requests sent with that field as an array failed at matching the mapping. When I deleted the index/type and tried it again, it auto mapped correctly as an array. So, all that to say, we can get it right, but it required mutators and accessors for the field in Eloquent, so we should probably add default functionality for this in Elkuent models.

jonbwhite commented 9 years ago

IIRC from similar issue with laravel-mongodb this only happens when you pass JSON via a form-data POST