The problem is that [exiftoolMetadata][exiftool][value]
is sometimes a string and sometimes a number. A particular Elasticsearch field must have a single type.
Your instinct to turn those key/value pairs into discrete fields is correct. Ruby examples of doing that have been posted in the past. Perhaps Split arrays of keys and values is helpful?