Create root field for all fields

You took THIS script, but you changed the quotes. String interpolation only works with double quotes, so with the single quotes Ruby didn't replace #{k} with the field name, but put every field content into a field called [message][#{k}]. The first entry that was produced this way, had an object there, so the dynamic mapping of ES mapped the field as an object. Others had concrete values and therefore caused this error in ES because the data types didn't match. You need to keep the quotes the way they were in the original example.

1 Like