Elasticsearch 8.5 JSON Parsing scenarios on Bulk Indexing with Nested Structures
I need help solving I recently switched to I'm experimenting with I'm learning this framework and I'm working on a personal project and I've been struggling with this for a few days now and could really use some help... I'm trying to bulk index documents into my Elasticsearch 8.5 instance, but I'm working with a JSON parsing behavior related to nested structures. The data I'm using has nested objects, and despite following the expected format, Elasticsearch throws an behavior: `"wrong type for field [nested_field]"`. My data structure resembles the following: ```json { "id": "1", "name": "John Doe", "address": { "street": "123 Main St", "city": "Anytown" }, "contacts": [ { "type": "email", "value": "john@example.com" }, { "type": "phone", "value": "555-1234" } ] } ``` When I try to insert this document using a bulk API call, I format it like this: ```json POST /my_index/_bulk {"index": {"_id": "1"}} {"id": "1", "name": "John Doe", "address": {"street": "123 Main St", "city": "Anytown"}, "contacts": [{"type": "email", "value": "john@example.com"}, {"type": "phone", "value": "555-1234"}]} ``` I have also defined the mappings for `my_index` as follows: ```json PUT /my_index { "mappings": { "properties": { "id": {"type": "keyword"}, "name": {"type": "text"}, "address": { "type": "nested", "properties": { "street": {"type": "text"}, "city": {"type": "text"} } }, "contacts": { "type": "nested", "properties": { "type": {"type": "keyword"}, "value": {"type": "text"} } } } } } ``` I have verified that the bulk request is formatted correctly and that the index mappings match the structure of the documents. However, I still get the parsing behavior. I also tried simplifying the document by removing the nested objects, and it gets indexed without issues, which leads me to believe that the nested structure is the question. Could someone guide to understand what might be going wrong with the bulk indexing of nested documents in this version of Elasticsearch? Any insights would be greatly appreciated! Any help would be greatly appreciated! For context: I'm using Json on macOS. For context: I'm using Json on CentOS. Thanks in advance! I'm coming from a different tech stack and learning Json. Thanks, I really appreciate it! Is there a simpler solution I'm overlooking?