elasticsearch/docs/reference/esql/functions
Craig Taverner 536d614694
ES|QL ST_DISTANCE Function (#108764)
* WIP Started refactoring in preparation for ST_DISTANCE

* Initial evaluators for ST_DISTANCE

* Update docs/changelog/108764.yaml

* Fix invalid changelog generated by CI

* Register function and get unit tests working

* Fixed failing meta function description tests, and refined descriptions

* Added initial CsvTests and calculate Geo differently to Cartesian

* Added more csv-spec tests and changed to arcDistance for accuracy

* Added generated docs files

* Link to generated docs

* Fix examples tag for linking from generated docs

* Skip wrapper function

And note that we might want to include instead some of the related intelligence from Circle2D::HaversineDistance class

* Added ST_DWITHIN and more tests for ST_DISTANCE and ST_DWITHIN

* Code style

* Added more tests, this time for sorting on distance

* Fixes after rebase on main

* The ST_DWITHIN cannot use BinarySpatialFunction because it is ternary

So we moved the common code to a separate SpatialTypeResolver, and made a simpler TernarySpatialFunction based on a simple TernaryScalarFunction. This had additional consequences, simplifying the points-only cases.

The main reason for this change was to support StDWithinTests which need to test a lot of things that involve varying all three input types, generating expected error strings, etc. The original hack of just adding to BinarySpatialFunction worked for the actual integration tests, but clearly did not satisfy all the use cases tested by the unit tests.

We also restricted ST_DWITHIN to take only a double as the third argument, because otherwise the number of evaluators would explode, since we need a separate evaluator for each Block type, and Integer and Double use different block types.

* Fixed function count after rebasing on main

* Update docs/changelog/108764.yaml

* Added generated docs for ST_DWITHIN

* Connect docs for ST_DWITHIN

* Add back issue link

* Remove support for ST_DWITHIN

* Update docs/changelog/108764.yaml

* Bring back link to issue in changelog

* Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StDistance.java

Co-authored-by: Ignacio Vera <iverase@gmail.com>

* Revert reformatting of function descriptions

We should put this into a separate PR

* Github merged commit with incorrectly formatted whitespace

---------

Co-authored-by: Ignacio Vera <iverase@gmail.com>
2024-06-21 11:59:44 +02:00
..
description ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
examples ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
kibana ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
layout ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
parameters ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
signature ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
types ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
README.md ESQL: Generate kibana inline docs (#106782) 2024-04-09 14:19:48 -04:00
aggregation-functions.asciidoc ESQL: Document BUCKET as a grouping function (#107864) 2024-04-25 12:38:12 -04:00
avg.asciidoc
binary.asciidoc ESQL: Warn about division (#109716) 2024-06-14 08:36:27 -04:00
case.asciidoc
cast.asciidoc ESQL: Document the cast operator (::) (#107871) 2024-04-25 10:10:59 -04:00
conditional-functions-and-expressions.asciidoc [ES|QL] Add/Modify annotations for spatial and conditional functions for better doc generation (#107722) 2024-05-10 14:49:25 -04:00
count-distinct.asciidoc
count.asciidoc
date-time-functions.asciidoc ES|QL: Add unit tests for now() function (#108498) 2024-05-10 14:28:19 +02:00
grouping-functions.asciidoc ESQL: Document BUCKET as a grouping function (#107864) 2024-04-25 12:38:12 -04:00
in.asciidoc
ip-functions.asciidoc Introduce an IP functions group (#108304) 2024-05-06 13:43:30 +02:00
like.asciidoc [ES|QL] Add/Modify annotations for operators for better doc generation (#108220) 2024-05-03 22:59:51 -04:00
logical.asciidoc
math-functions.asciidoc ESQL: CBRT function (#108574) 2024-05-15 16:50:15 +02:00
max.asciidoc
median-absolute-deviation.asciidoc
median.asciidoc
min.asciidoc
mv-functions.asciidoc ES|QL: reduce memory footprint for MvAppendTests with shapes (#109517) 2024-06-13 02:44:49 +10:00
operators.asciidoc Introduce an IP functions group (#108304) 2024-05-06 13:43:30 +02:00
percentile.asciidoc
predicates.asciidoc
rlike.asciidoc [ES|QL] Add/Modify annotations for operators for better doc generation (#108220) 2024-05-03 22:59:51 -04:00
round.asciidoc
spatial-functions.asciidoc ES|QL ST_DISTANCE Function (#108764) 2024-06-21 11:59:44 +02:00
st_centroid_agg.asciidoc Rename ST_CENTROID to ST_CENTROID_AGG (#107226) 2024-04-10 17:56:45 +02:00
string-functions.asciidoc ESQL: add REPEAT string function (#109220) 2024-06-04 16:32:43 -05:00
sum.asciidoc
type-conversion-functions.asciidoc [DOCS] ES|QL implicit casting (#108618) 2024-05-15 09:07:09 -04:00
unary.asciidoc
values.asciidoc ESQL: Enable VALUES agg for datetime (#107016) 2024-04-03 07:42:40 -04:00

README.md

The files in these subdirectories are generated by ESQL's test suite:

  • description - description of each function scraped from @FunctionInfo#description
  • examples - examples of each function scraped from @FunctionInfo#examples
  • parameters - description of each function's parameters scraped from @Param
  • signature - railroad diagram of the syntax to invoke each function
  • types - a table of each combination of support type for each parameter. These are generated from tests.
  • layout - a fully generated description for each function
  • kibana/definition - function definitions for kibana's ESQL editor
  • kibana/docs - the inline docs for kibana

Most functions can use the generated docs generated in the layout directory. If we need something more custom for the function we can make a file in this directory that can include:: any parts of the files above.

To regenerate the files for a function run its tests using gradle:

./gradlew :x-pack:plugin:esql:test -Dtests.class='*SinTests'

To regenerate the files for all functions run all of ESQL's tests using gradle:

./gradlew :x-pack:plugin:esql:test