-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
In the flat_object function, which is responsible for converting nested JSON data into a flattened format, there is an issue related to handling JSON arrays containing multiple objects.
Specifically, the function incorrectly removes the array field name from the path after processing the first object within the array. As a result, when processing subsequent objects in the same array, the flattened key-path lacks the correct array field name, leading to inaccurate representation of the data structure.
Related component
Indexing
To Reproduce
Here is the test code to reproduce the issue.
#13259 (comment)
Expected behavior
The expected behavior of the test code is to correctly flatten the nested JSON structure into a simple, flat format without losing any structural context due to array processing.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context
This issue can be reproduced in OpenSearch 2.12.