elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.79k stars 24.7k forks source link

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

Open craigtaverner opened 2 days ago

craigtaverner commented 2 days ago

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:

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

elasticsearchmachine commented 2 days ago

Pinging @elastic/es-analytical-engine (Team:Analytics)

drewdaemon commented 2 days ago

This may also apply to REVERSE

nik9000 commented 2 days ago

I think we should assert in the tests that no function ever spits out text. At some point we'll make an ANALYZE function that does and we can hack around the assertion for that one function. Otherwise they never should.