Skip to content

[FEATURE] Support merging object-type fields when fetching the schema from the index #3625

Closed

Description

@penghuo

Is your feature request related to a problem?
Currently, when the same object field (e.g., log) contains different inner fields in different indices, PPL randomly pick one, then PPL fails to resolve queries referencing any of them.

  • with data
###
POST {{baseUrl}}/logs-test-ppl-json-plain/_doc
Content-Type: application/x-ndjson

{
  "@timestamp": "2025-05-05T09:33:00Z",
  "message": "text message 3",
  "log": {
    "file": "/var/log/msg"
  }
}

###
POST {{baseUrl}}/logs-test-ppl-json-default/_doc
Content-Type: application/x-ndjson

{
  "message": "json message 1",
  "@timestamp": "2025-05-13T09:55:00Z",
  "log": {
    "level": "ERROR"
  }
}
  • run query
source = logs-* | where log.file= '/var/log/msg'

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

What solution would you like?
PPL should support merging object-type field definitions across indices (e.g., log.file, log.level) into a unified schema, so queries can reference valid fields even if they're only present in some indices.

Activity

  1. anasalkouz commented on May 15, 2025

    @anasalkouz
    Member

    Is this issue PPL specific? Does SQL and DSL support it?

  2. penghuo commented on May 15, 2025

    @penghuo
    CollaboratorAuthor

    Is this issue PPL specific? Does SQL and DSL support it?

    Both for SQL and PPL.
    DSL works well.

  3. added
    PPL
    on May 16, 2025
  4. penghuo commented on May 16, 2025

    @penghuo
    CollaboratorAuthor

    What solution would you like?
    PPL should support merging object-type field definitions across indices (e.g., log.file, log.level) into a unified schema, so queries can reference valid fields even if they're only present in some indices.

    Merge solution does not scale. OpenSearch supports the _field_caps API, which returns merged field definitions across indices. It performs well with a small number of indices, but when querying over 1,000 indices, the latency can exceed 10 seconds.

  5. added
    bug
    and removed
    enhancement
    on May 20, 2025
  6. RyanL1997 commented on May 20, 2025

    @RyanL1997
    Collaborator

    We may also need to backport this.

  7. xluo-aws commented on May 26, 2025

    @xluo-aws
    Member

    Got similar issue when testing opentelemetry log data. Use * to query index, but if there is no user activity for a specific day, log attribute nested field will not have userid as a nested field, if query specify user id, it fails with same error as above

  8. brijos commented on Jun 12, 2025

    @brijos

    Can we update the status of this issue?

  9. LantaoJin commented on Jun 16, 2025

    @LantaoJin
    Member

    Should be resolved by #3653

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLPriority-HighSQLbugv3.1.0

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions