Skip to content

ES|QL: columns not projected away despite KEEP #126026

@luigidellaquila

Description

@luigidellaquila
row foo = 10 
| stats field_1 = max(foo), this = count(*), field_2 = max(foo) by foo  
| rename this AS field_2 
| keep field_1, field_2  
| eval field_2 = 1, field_1 = 1
      foo      |    field_1    |    field_2    
---------------+---------------+---------------
10             |1              |1              

foo shouldn't be there.

Interestingly, if you try to use the wrong column, the query will fail:

row foo = 10 
| stats field_1 = max(foo), this = count(*), field_2 = max(foo) by foo  
| rename this AS field_2 
| keep field_1, field_2  
| eval field_2 = 1, field_1 = 1, bar = foo
{
    "error": {
        "root_cause": [
            {
                "type": "verification_exception",
                "reason": "Found 1 problem\nline 1:176: Unknown column [foo]"
            }
        ],
        "type": "verification_exception",
        "reason": "Found 1 problem\nline 1:176: Unknown column [foo]"
    },
    "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