-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE]Add flatten
Command to PPL
#669
Comments
Shouldn't it be bridges.name in flattened object? |
As mentioned above "Consider supporting multi-level flattening for more deeply nested fields (e.g., flatten details.address)." I read it as: yes, we support it. Question is what is the default and should it be configurable? When dealing with nested fields, see #565 |
Before opening a PR, a few design questions and requirement refinements need to be discussed.
|
source=employees
| flatten contact
| fields name, age, contact.phone as phone, contact.address.city as city, contact.address.zipcode as zipcode
results using alias:
source=employees
| flatten contact
| fields name, age, contact.phone, contact.address.city, contact.address.zipcode results:
|
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: