Skip to content

TEXT fields should be converted to KEYWORD by any function that changes their values #114333

@craigtaverner

Description

@craigtaverner

In ES|QL, many functions can take both KEYWORD and TEXT as input parameters, and change their values to strings. This change destroys the meaning of any analyzer associated with the original TEXT, and so the output should always be KEYWORD. But several functions mistakenly return TEXT (ie. return their input data type).

Functions known to have this issue:

  • Explicitly returning field.dataType
    • ToUpper
    • ToLower
  • Implicitly as a result of extending UnaryScalarFunction:
    • LTrim
    • RTrim
    • Trim
    • Reverse

Other functions that take TEXT but already are fixed to only return KEYWORD:

  • ToString
  • FromBase64
  • ToBase64
  • Replace
  • Right
  • Left

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions