elasticsearch/docs/reference/esql
Craig Taverner 3d307e0d78
Don't return TEXT type for functions that take TEXT (#114334)
Always return `KEYWORD` for functions that previously returned `TEXT`, because any change to the value, no matter how small, is enough to render meaningless the original analyzer associated with the `TEXT` field value. In principle, if the attribute is no longer the original `FieldAttribute`, it can no longer claim to have the type `TEXT`.

This has been done for all functions: conversion functions, aggregating functions, multi-value functions. There were several that already produced `KEYWORD` for `TEXT` input (eg. ToString, FromBase64 and ToBase64, MvZip, ToLower, ToUpper, DateFormat, Concat, Left, Repeat, Replace, Right, Split, Substring), but many others that incorrectly claimed to produce `TEXT`, while this was really a false claim. This PR makes that now strict, and includes changes to the functions' units tests to disallow the tests to expect any functions output to be `TEXT`.

One side effect of this change is that methods that take multiple parameters that require all of them to have the same type, will now treat TEXT and KEYWORD the same. This was already the case for functions like `Concat`, but is now also the case for `Greatest`, `Least`, `Case`, `Coalesce` and `MvAppend`.

An associated change is that the type casting operator `::text` has been entirely removed. It used to map onto the `ToString` function which returned type KEYWORD, and so `::text` really produced a `KEYWORD`, which is a lie, or at least a `bug`, which is now fixed. Should we ever wish to actually produce real `TEXT`, we might love the fact that this operator has been freed up for future use (although it seems likely that function will require parameters to specify the analyzer, so might never be an operator again).

### Backwards compatibility issues:

This is a change that will fail BWC tests, since we have many tests that assert on TEXT output to functions. For this reason we needed to block two scenarios:

* We used the capability `functions_never_emit_text` to prevent 7 csv-spec tests and 2 yaml tests from being run against older versions that still emit text.
* We used `skipTest` to also block those two yaml tests from being run against the latest build, but using older yaml files downloaded (as far back as 8.14).

In all cases the change observed in these tests was simply the results columns no longer having `text` type, and instead being `keyword`.

---------

Co-authored-by: Luigi Dell'Aquila <luigi.dellaquila@gmail.com>
2024-10-25 10:09:53 +02:00
..
functions Don't return TEXT type for functions that take TEXT (#114334) 2024-10-25 10:09:53 +02:00
processing-commands [DOCS] ES|QL: Adding a tip to the WHERE documentation (#114050) 2024-10-14 13:05:12 -05:00
source-commands ESQL: Validate unique plan attribute names (#110488) 2024-07-17 11:39:02 +02:00
esql-across-clusters.asciidoc CCS metadata is opt-in in ESQL JSON responses (#114437) 2024-10-11 15:03:26 -04:00
esql-apis.asciidoc (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
esql-async-query-api.asciidoc Remove esql version from docs (#108933) 2024-05-23 10:36:15 -04:00
esql-async-query-delete-api.asciidoc (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
esql-async-query-get-api.asciidoc Add ES|QL async query api docs (#104054) 2024-01-09 09:17:02 +00:00
esql-commands.asciidoc ESQL: INLINESTATS (#109583) 2024-07-24 17:16:37 -04:00
esql-enrich-data.asciidoc [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00
esql-examples.asciidoc [DOCS] Small ES|QL improvements (#101877) 2023-11-07 17:24:59 +01:00
esql-functions-operators.asciidoc Introduce an IP functions group (#108304) 2024-05-06 13:43:30 +02:00
esql-get-started.asciidoc Revert "[DOCS] Remove ESQL demo env link from 8.14+ (#109562)" (#109579) 2024-06-11 17:04:37 +02:00
esql-kibana.asciidoc [DOCS] Update Using ESQL in Kibana doc (#108715) 2024-05-17 12:36:04 +02:00
esql-language.asciidoc ESQL: Remove OPTIONS clause in FROM command (#108692) 2024-05-15 18:15:02 -04:00
esql-limitations.asciidoc Union types documentation (#110183) 2024-07-16 12:06:19 +02:00
esql-multi-index.asciidoc ESQL: Fix for overzealous validation in case of invalid mapped fields (#111475) 2024-08-09 09:38:14 +02:00
esql-process-data-with-dissect-grok.asciidoc ES|QL: improve docs about escaping for GROK, DISSECT, LIKE, RLIKE (#115320) 2024-10-24 09:19:46 +02:00
esql-query-api.asciidoc CCS metadata is opt-in in ESQL JSON responses (#114437) 2024-10-11 15:03:26 -04:00
esql-rest.asciidoc Collect and display execution metadata for ES|QL cross cluster searches (#112595) 2024-09-30 16:03:39 -04:00
esql-security-solution.asciidoc Update esql-security-solution.asciidoc (#104531) 2024-01-18 15:48:43 +01:00
esql-syntax.asciidoc ESQL: Add more time span units (#108300) 2024-05-08 08:51:02 -04:00
esql-using.asciidoc Union types documentation (#110183) 2024-07-16 12:06:19 +02:00
implicit-casting.asciidoc [DOCS] ES|QL implicit casting (#108618) 2024-05-15 09:07:09 -04:00
index.asciidoc [DOCS] ESQL goes GA (#108342) 2024-05-07 14:12:50 +02:00
metadata-fields.asciidoc Reapply "ESQL: Expose "_ignored" metadata field" (#108864) (#108871) 2024-05-22 07:06:04 -04:00
multivalued-fields.asciidoc Docs: ESQL doesn't preserve nulls in a list (#114335) 2024-10-09 03:17:56 +11:00
task-management.asciidoc [DOCS] One more round of restructuring the ES|QL documentation (#101340) 2023-10-26 10:57:05 +02:00