Skip to content

[BUG] PPL query fails to recognize field aliases in Opensearch #3290

@vamsimanohar

Description

@vamsimanohar

Description

When using PPL (Piped Processing Language) to query Opensearch indices that use field aliases, the query fails to recognize the aliased field names. This prevents users from leveraging field aliases in their PPL queries, which is inconsistent with the behavior in standard Opensearch queries.

Steps to Reproduce

  1. Create an Opensearch index with field aliases:

    PUT /traces
    {
      "mappings": {
        "properties": {
          "trace.id": {
            "type": "keyword"
          },
          "traceId": {
            "type": "alias",
            "path": "trace.id"
          }
        }
      }
    }
    
  2. Index sample data:

    POST /traces/_doc
    {
      "trace.id": "abc123"
    }
    
  3. Attempt to query using PPL with the field alias:

    POST _plugins/_ppl
    {
      "query" : "search source=traces | where traceId = 'abc123'"
    }
    

Expected Behavior

The PPL query should recognize the field alias "traceId" and successfully return the matching document.

Actual Behavior

The query fails with the following error:

{
  "error": {
    "reason": "Invalid Query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=traceId) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions