Need help mapping dynamic keys

I checked out other topics here. I need help creating mappings in ElasticSearch for the following kind of JSON data:

[
{
"type": "wizard",
"id": "UUID String",
"external_id": null,
"attributes": {
"name": "Fleur Delacour",
"wand": "14'' Willow and Unicorn",
"school": "Beauxbatons"
},
"created_at": "2019-05-07T18:17:29.977Z",
"updated_at": "2019-05-07T18:17:30.000Z"
},
{
"type": "wizard",
"id": "UUID String",
"external_id": "abcd",
"attributes": {
"name": "Harry Potter",
"wand": "14'' Willow and Unicorn",
"school": "Beauxbatons"
},
"created_at": "2019-05-07T18:18:01.464Z",
"updated_at": "2019-05-07T18:18:01.000Z"
}
]

Out of this JSON, the dynamic part is:
"attributes": {
"name": "Harry Potter",
"wand": "14'' Willow and Unicorn",
"school": "Beauxbatons"
}

The value for the key "attributes" will differ. One JSON may have the keys "name", "wand", "school". There could be another JSON that has the keys "abc", "hello", "new" with different values.

How do I create such a mapping? Also, how do I deal with nested attributes?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.