Stored Scripts as UDFs in Elasticsearch SQL #34380
Labels
:Analytics/SQL
SQL querying
>feature
Team:Analytics
Meta label for analytical engine team (ESQL/Aggs/Geo)
It would be great to use stored scripts as user-defined functions (UDFs) in Elasticsearch SQL for arbitrary string manipulations, computations, and aggregations.
Proposed Syntax
Proposed syntax for calling a stored script as a UDF in Elasticsearch SQL:
Breakdown:
script-name
is the name of the stored script.arg
is the name of a variable referenced in the stored script.value
is the value of the arg.Alternatively:
script.
) so that we don't need to worry about conflicts with reserved keywords such as "select".Example
Let's assume someone creates this stored script:
Example query using the example script:
Alternatively, using the prefixed syntax:
The text was updated successfully, but these errors were encountered: