You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem?
OpenSearch Piped Processing Language (PPL) currently lacks a native command to flatten nested objects or arrays in documents. Many datasets, especially those containing JSON objects, have deeply nested fields that are difficult to work with in their raw form. The flatten command will simplify these structures and make it easier to analyze and extract data.
What solution would you like?
Introduce a flatten command in PPL that can handle arrays or nested fields, producing a flattened result that contains all the nested elements at the top level.
Note: recommend that we update the proposed syntax as per opensearch-project/opensearch-spark#1024 to only accept STRUCT data types (not ARRAY) and instead recommend that users pipe expand into flatten to explain columns and rows.
This command has a slightly updated syntax - see spark ppl flatten for additional details
### Description
Using `flatten` command to flatten a field of type:
-`struct<?,?>`-`array<struct<?,?>>`### Syntax`flatten <field> [As aliasSequence]`* field: to be flattened. The field must be of supported type.
* aliasSequence: to be used as aliasSequence for the flattened-output fields. Better to put the aliasSequence in brace if there is more than one field.
Is your feature request related to a problem?
OpenSearch Piped Processing Language (PPL) currently lacks a native command to flatten nested objects or arrays in documents. Many datasets, especially those containing JSON objects, have deeply nested fields that are difficult to work with in their raw form. The
flatten
command will simplify these structures and make it easier to analyze and extract data.What solution would you like?
Introduce a flatten command in PPL that can handle arrays or nested fields, producing a
flattened
result that contains all the nested elements at the top level.Syntax:
flatten
command takes a nested array or object field and returns each element as part of a flat structure.Example Use Cases
This query
flattens
the bridges array field.Example Input:
Expected Output:
This query
flattens
the details object field.Example Input:
Expected Output:
Additional Considerations
The text was updated successfully, but these errors were encountered: