Skip to content

ESQL: QSTR/KQL functions after SORT stop being allowed when using an unmapped field after them #142959

@astefan

Description

@astefan

Description

SET unmapped_fields="nullify";
 from airports
| sort city
| where qstr("country:test")
| stats min(unmapped_field_baz)

results in

[QSTR] function cannot be used after SORT",
                "stack_trace": "org.elasticsearch.xpack.esql.VerificationException: Found 1 problem
line 5:3: [QSTR] function cannot be used after SORT
at org.elasticsearch.xpack.esql.analysis.Analyzer.verify(Analyzer.java:280)
at org.elasticsearch.xpack.esql.analysis.Analyzer.analyze(Analyzer.java:274)

If stats is on an existent field, then things are resulting in an error.
Quickly checking the code at FullTextFunction.checkFullTextQueryFunctionForCondition a SORT command should be ok before QSTR command under unrelated conditions. But the query above should be ok for QSTR usage.

Metadata

Metadata

Labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions