Skip to content

[BUG] Query workbench PPL 'parse' syntax doesn't work on nested/non-single line field values #3206

Closed as duplicate

Description

@opensearch1

Describe the bug

'parse' PPL syntax doesn't seem to extract nested/non-single line field values. Documentation examples are very limited (ref https://github.com/opensearch-project/sql/blob/main/docs/user/ppl/cmd/parse.rst)

Related component

Search:Query Capabilities

To Reproduce

  1. Go to Query workbench then select PPL
  2. Query indexes that have nested field values

Expected behavior

Parse syntax should return a field value

Additional Details

parse2
parse1

Activity

  1. added
    bug
    on Dec 18, 2024
  2. YANG-DB commented on Dec 18, 2024

    @YANG-DB
    Member

    Thanks for bringing this to our attention.

  3. added
    PPL
    on Dec 18, 2024
  4. acarbonetto commented on Dec 18, 2024

    @acarbonetto
    Collaborator

    I was able to run this query using parse on nested values, to get this result:

    /_plugins/_ppl:
    {
      "query" : "source=nested | parse message.info '.*a(?<name>.+)' | fields message.info, name"
    }
    
    Response: 
    {
        "schema": [
            {
                "name": "message.info",
                "type": "string"
            },
            {
                "name": "name",
                "type": "string"
            }
        ],
        "datarows": [
            [
                "a",
                ""
            ],
            [
                "bab",
                "b"
            ],
            [
                "aba",
                "ba"
            ]
        ],
        "total": 3,
        "size": 3
    }
    

    The parse command doesn't work against multi-values, and results in an error:

    /_plugins/_ppl:
    {
      "query" : "source=nested | parse message.info '.*a(?<name>.+)' | fields message.info, name"
    }
    
    Response: 
    {
        "schema": [
            {
                "name": "mv",
                "type": "string"
            }
        ],
        "datarows": [
            [
                [
                    "aaab",
                    "aab",
                    "ab",
                    "b"
                ]
            ],
            [
                "aaac"
            ],
            [
                [
                    "d",
                    "ad",
                    "aad",
                    "aaad"
                ]
            ]
        ],
        "total": 3,
        "size": 3
    }
    
    /_plugins/_ppl:
    {
      "query" : "source=nested | parse mv '.*a(?<name>.+)' | fields mv, name"
    }
    
    Response: 
    {
      "error": {
        "reason": "Invalid Query",
        "details": "failed to parse field \"mv\" with type [ARRAY]",
        "type": "SemanticCheckException"
      },
      "status": 400
    }
    
  5. acarbonetto commented on Dec 18, 2024

    @acarbonetto
    Collaborator

    We could be more explicit about how the syntax works in the documentation: https://github.com/opensearch-project/sql/blob/main/docs/user/ppl/cmd/parse.rst

    Also, add a limitation that multi-valued fields result in an error.

  6. YANG-DB commented on Dec 18, 2024

    @YANG-DB
    Member

    @acarbonetto I've asked for details on the version this issue was discovered

  7. acarbonetto commented on Dec 18, 2024

    @acarbonetto
    Collaborator

    I think there's a problem with your match query: .+(?<name>.+) won't match anything for name. The .+ match is a wildcard matcher that will pick up everything leaving nothing to put into the name field. According to the screenshot, name is returning empty string results (I believe that's what's going on).

    Depending on your data, you can try and include a pattern that matches more than one variable in the field.

  8. opensearch1 commented on Dec 19, 2024

    @opensearch1
    Author

    Hi,

    This is being used in OpenSearch 2.15 under query workbench.

  9. opensearch1 commented on Dec 20, 2024

    @opensearch1
    Author

    @acarbonetto it looks that way since I just copied the unparsed values. it looks like a table (unsure if it's JSON or something else) that there's set of fields and values (see screenshot). The complete values appear when I hover the mouse or copy them.
    parse3

  10. andy-k-improving commented on Jan 15, 2025

    @andy-k-improving
    Contributor

    @acarbonetto it looks that way since I just copied the unparsed values. it looks like a table (unsure if it's JSON or something else) that there's set of fields and values (see screenshot). The complete values appear when I hover the mouse or copy them. parse3

    @opensearch1 I can confirm indeed the hover is expected behaviour in the case of displaying nested field, similar to fields geo, event and machine from the sample dataset provided by OpenSearch out of the box.

    Image

    In this particular case, would you mind to share the query along with the expected pattern you would like to achieve under the parse command but failed to do so?

    Also in the case of Bad request, there should be a Java exception being thrown in the backend, which would be great if you can share such information, if policy is allowed.

  11. songkant-aws commented on Jun 27, 2025

    @songkant-aws
    Collaborator

    Looking into it

  12. LantaoJin commented on Jun 27, 2025

    @LantaoJin
    Member

    For multi-value, PPL in v3, we have fatten and expand functions to handle them.

  13. qianheng-aws commented on Apr 10, 2026

    @qianheng-aws
    Collaborator

    Closing as duplicate of #5333 — consolidated umbrella issue for array values not treated as atomic values.

  14. moved this from Not Started to Done in PPL Trackeron Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLbug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions