Skip to content

[BUG] Field Name Incorrectly Popped from Path in flat_object During Array Processing #13351

@naomichi-y

Description

@naomichi-y

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workingv2.17.0v3.0.0Issues and PRs related to version 3.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions