Skip to content

[BUG] PPL query return null when access valid inner json object #4906

Open

Description

@penghuo

How can one reproduce the bug?

###
PUT {{baseUrl}}/log00001
Content-Type: application/x-ndjson

{
  "mappings": {
    "properties": {
      "log": {
        "type": "object",
        "enabled": false
      }
    }
  }
}

###
POST {{baseUrl}}/log00001/_bulk
Content-Type: application/x-ndjson

{"index": {}}
{"log": {"a":1, "c": {"d": 2}}}

###
POST {{baseUrl}}/_plugins/_ppl/
Content-Type: application/x-ndjson

{
  "query": "source=log00001 | fields log.c.d"
}
  • Results
{
  "schema": [
    {
      "name": "log.c.d",
      "type": "undefined"
    }
  ],
  "datarows": [
    [
      null
    ]
  ],
  "total": 1,
  "size": 1
}

What is the expected behavior?
It should return

{
  "schema": [
    {
      "name": "log.c.d",
      "type": "int"
    }
  ],
  "datarows": [
    [
      2
    ]
  ],
  "total": 1,
  "size": 1
}

Activity

  1. added
    bug
    PPL
    on Dec 4, 2025
  2. LantaoJin commented on Dec 8, 2025

    @LantaoJin
    Member

    It seems only happen when "enabled": false

  3. LantaoJin commented on Dec 8, 2025

    @LantaoJin
    Member

    We cannot get the actual mapping if a field is disabled

    PUT disabled
    {
      "mappings": {
        "properties": {
          "log": {
            "type": "object",
            "enabled": false
          }
        }
      }
    }
    PUT enabled
    {
      "mappings": {
        "properties": {
          "log": {
            "type": "object"
          }
        }
      }
    }
    

    Add data

    {"index": {}}
    {"log": {"a":1, "c": {"d": 2}}}
    

    GET enabled/_mapping returns

    {
      "enabled": {
        "mappings": {
          "properties": {
            "log": {
              "properties": {
                "a": {
                  "type": "long"
                },
                "c": {
                  "properties": {
                    "d": {
                      "type": "long"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    

    GET disabled/_mapping returns

    {
      "disabled": {
        "mappings": {
          "properties": {
            "log": {
              "type": "object",
              "enabled": false
            }
          }
        }
      }
    }
    
  4. LantaoJin commented on Dec 8, 2025

    @LantaoJin
    Member

    As a result (SQL plugin never know there is a field log.c.d), its type is undefined instead of any since SQL plugin doesn't know there is an internal field log.c.d.
    The query source=test | fields log.c.d has no difference with source=test | fields log.c.not_existed_field

    {
      "schema": [
        {
          "name": "log.c.not_existed_field",
          "type": "undefined"
        }
      ],
      "datarows": [
        [
          null
        ]
      ],
      "total": 1,
      "size": 1
    }
    
  5. LantaoJin commented on Dec 8, 2025

    @LantaoJin
    Member

    There is a similar case in dynamic mapping

    PUT test3
    {
      "mappings": {
        "dynamic": false
      }
    }
    
    POST test3/_bulk
    {"index": {}}
    {"a": 1}
    

    Query

    POST /_plugins/_ppl/
    {
      "query": """
    source=test3 | fields a
      """
    }
    

    throws "Field [a] not found", because the mapping result doesn't include a

    {
      "test3": {
        "mappings": {
          "dynamic": "false"
        }
      }
    }
    
  6. self-assigned this
    on Dec 15, 2025
  7. LantaoJin commented on Jan 12, 2026

    @LantaoJin
    Member

    This issue should be resolved by #4984

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