elasticsearch/docs/reference/esql/functions
Craig Taverner 2380492fac
ESQL: Support ST_CONTAINS and ST_WITHIN (#106503)
* WIP Started adding ST_CONTAINS

* Add generated evaluators

* Reduced warnings and use correct evaluators

* Refactored tests to remove duplicate code, and fixed Contains/multi-components

* Gradle build disallows using getDeclaredField

* Fixed cases where rectangles cross the dateline

* Fixed meta function tests

* Added ST_WITHIN to support inverting ST_CONTAINS

If the ST_CONTAINS is called with the constant on the left, we either have to create a lot more Evaluators to cover that case, or we have to invert it to ST_WITHIN. This inversion was a much easier option.

* Simplify inversion logic

* Add comment on choice of surrogate approach

* Add unit tests and missing fold() function

* Simple code cleanup

* Add integration tests for literals

* Add more integration tests based on actual data

* Generated documentation files

* Add documentation

* Fixed failing function count test

* Add tests that push-to-source works for ST_CONTAINS and ST_WITHIN

* Test more combinations of WITH/CONTAINS and literal on right and left

This also verifies that the re-writing of CONTAINS to WITHIN or vice versa occurs when the literal is on the left.

* test that physical planning also handles doc-values from STATS

* Added more tests for WITHIN/CONTAINS together with CENTROID

This should test the doc-values for points.

* Add cartesian_point tests

* Add cartesian_shape tests

* Disable Lucene-push-down for CARTESIAN data

This is a limitation in Lucene, which we could address as a performance optimization in a future PR, but since it probably requires Lucene changes, it cannot be done in this work.

* Fix doc links

* Added test data and tests for cartesian multi-polygons

Testing INTERSECTS, CONTAINS and WITHIN with multi-polydon fields

* Use required features for spatial points, shapes and centroid

* 8.13.0 is not yet historical version

This needs to be reverted as soon as 8.13.0 is released

* Added st_intersects and st_contains_within 'features'

* Code review updates

* Re-enable lucene push-down

* Added more required_features

* Fix point contains non-point

* Fix point contains point

* Re-enable lucene push-down in tests too

Forgot to change the physical planner unit tests after re-enabling lucene push-down

* Generate automatic docs

* Use generated examples docs

* Generated examples use '-result' prefix (singular)

* Mark spatial functions as preview/experimental
2024-04-02 10:31:00 +02:00
..
description ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
examples ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
layout ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
parameters ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
signature ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
types ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
aggregation-functions.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
auto_bucket.asciidoc ESQL: Mark a few features as experimental (#105263) 2024-02-07 17:28:13 -08:00
avg.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
binary.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
case.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
cidr_match.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
coalesce.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
concat.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
conditional-functions-and-expressions.asciidoc Add improvements to the ES|QL docs (#101195) 2023-10-23 07:45:42 -07:00
cosh.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
count-distinct.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
count.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
date-time-functions.asciidoc ESQL: Mark a few features as experimental (#105263) 2024-02-07 17:28:13 -08:00
date_diff.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
date_extract.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
date_format.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
date_parse.asciidoc [DOCS] Small ES|QL improvements (#101877) 2023-11-07 17:24:59 +01:00
date_trunc.asciidoc [DOCS] Improve ES|QL functions reference for functions A-D (#103447) 2023-12-19 15:59:02 +01:00
e.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
ends_with.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
floor.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
greatest.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
in.asciidoc [DOCS] Examples for ES|QL DISSECT and WHERE (#102591) 2023-11-27 10:56:48 +01:00
least.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
length.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
like.asciidoc [DOCS] Examples for ES|QL DISSECT and WHERE (#102591) 2023-11-27 10:56:48 +01:00
log.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
log10.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
logical.asciidoc Restructure ES|QL docs (#100806) 2023-10-17 17:36:14 +02:00
ltrim.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
math-functions.asciidoc ESQL: Generate docs for the trig functions (#106891) 2024-03-29 12:24:31 -04:00
max.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
median-absolute-deviation.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
median.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
min.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
mv-functions.asciidoc [ES|QL] Add mv_sort (#106095) 2024-03-13 12:04:12 -04:00
mv_avg.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_concat.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_count.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_dedupe.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_first.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_last.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_max.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_median.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_min.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_slice.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_sort.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_sum.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
mv_zip.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
now.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
operators.asciidoc [ESQL] Remove is_nan, is_finite, and is_infinite (#104091) 2024-01-09 14:51:32 -05:00
percentile.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
pi.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
pow.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
predicates.asciidoc [DOCS] Examples for ES|QL DISSECT and WHERE (#102591) 2023-11-27 10:56:48 +01:00
README.md Fix typo in functions/README.md (#106870) 2024-03-28 14:02:47 +01:00
replace.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
right.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
rlike.asciidoc [DOCS] Examples for ES|QL DISSECT and WHERE (#102591) 2023-11-27 10:56:48 +01:00
round.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
rtrim.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
spatial-functions.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
split.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
sqrt.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
st_centroid.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
st_contains.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
st_intersects.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
st_within.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
st_x.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
st_y.asciidoc ESQL: Support ST_CONTAINS and ST_WITHIN (#106503) 2024-04-02 10:31:00 +02:00
starts_with.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
string-functions.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
substring.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
sum.asciidoc [DOCS] Support for nested functions in ES|QL STATS...BY (#104788) 2024-01-30 19:29:12 +01:00
tau.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_boolean.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_cartesianpoint.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_cartesianshape.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_datetime.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_degrees.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_double.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_geopoint.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_geoshape.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_integer.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_ip.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_long.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_lower.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_radians.asciidoc [DOCS] Improve ES|QL functions reference for functions E-Z (#104623) 2024-01-25 16:32:24 +01:00
to_string.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_unsigned_long.asciidoc ESQL: Mark a few features as experimental (#105263) 2024-02-07 17:28:13 -08:00
to_upper.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
to_version.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
trim.asciidoc ESQL: Generate more docs (#106367) 2024-03-19 15:40:13 -04:00
type-conversion-functions.asciidoc ESQL: Mark a few features as experimental (#105263) 2024-02-07 17:28:13 -08:00
unary.asciidoc ESQL: Add type tables for operators to docs (#103206) 2023-12-11 10:51:38 -05:00
values.asciidoc ESQL: Values aggregation function (#106065) 2024-03-21 12:52:04 -04:00

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

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