Skip to content

Commit 0722687

Browse files
9.0 esql docs backport (elastic#125833)
Manual backport of two PRs: * elastic#125155 * elastic#125251 Even though the docs are not needed in 9.0, due to all docs being published off main, doing the backport makes future backports of non-docs, but docs-adjacent PRs easier.
1 parent e39ef2b commit 0722687

37 files changed

+532
-191
lines changed

docs/reference/query-languages/esql/_snippets/functions/description/to_aggregate_metric_double.md

-6
This file was deleted.

docs/reference/query-languages/esql/_snippets/functions/examples/to_lower.md

+1-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/layout/to_aggregate_metric_double.md

-23
This file was deleted.

docs/reference/query-languages/esql/_snippets/functions/parameters/to_aggregate_metric_double.md

-7
This file was deleted.

docs/reference/query-languages/esql/_snippets/functions/parameters/to_lower.md

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/parameters/to_upper.md

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/images/functions/to_aggregate_metric_double.svg

-1
This file was deleted.

docs/reference/query-languages/esql/kibana/definition/functions/to_aggregate_metric_double.json

-9
This file was deleted.

docs/reference/query-languages/esql/kibana/definition/functions/to_lower.json

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/to_upper.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/to_aggregate_metric_double.md

-7
This file was deleted.

x-pack/plugin/esql/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ tasks.named("test").configure {
167167

168168
List kibana = kibanaTree.files.collect { it.name }
169169
int countKibana = kibana.size()
170+
Closure replaceLinks = line -> {
171+
// The kibana docs are not deployed to the normal docs location, so need absolute paths for internal references
172+
line.replaceAll(
173+
/\]\(\/reference\/([^)\s]+)\.md(#\S+)?\)/,
174+
'](https://www.elastic.co/docs/reference/elasticsearch/$1$2)'
175+
)
176+
}
170177
if (countKibana == 0) {
171178
logger.quiet("ESQL Docs: No function/operator kibana docs created. Skipping sync.")
172179
} else {
@@ -181,6 +188,7 @@ tasks.named("test").configure {
181188
include '**/*.md', '**/*.json'
182189
}
183190
}
191+
filter replaceLinks
184192
}
185193
}
186194
}

x-pack/plugin/esql/qa/testFixtures/src/main/resources/convert.csv-spec

+4-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ emp_no:integer | languages:integer | height:double
218218
convertToDatePeriod
219219
required_capability: cast_string_literal_to_temporal_amount
220220
//tag::castToDatePeriod[]
221-
row x = "2024-01-01"::datetime | eval y = x + "3 DAYS"::date_period, z = x - to_dateperiod("3 days");
221+
ROW x = "2024-01-01"::datetime
222+
| EVAL y = x + "3 DAYS"::date_period, z = x - TO_DATEPERIOD("3 days");
222223
//end::castToDatePeriod[]
223224

224225
//tag::castToDatePeriod-result[]
@@ -230,7 +231,8 @@ x:datetime |y:datetime |z:datetime
230231
convertToTimeDuration
231232
required_capability: cast_string_literal_to_temporal_amount
232233
//tag::castToTimeDuration[]
233-
row x = "2024-01-01"::datetime | eval y = x + "3 hours"::time_duration, z = x - to_timeduration("3 hours");
234+
ROW x = "2024-01-01"::datetime
235+
| EVAL y = x + "3 hours"::time_duration, z = x - TO_TIMEDURATION("3 hours");
234236
//end::castToTimeDuration[]
235237

236238
//tag::castToTimeDuration-result[]

x-pack/plugin/esql/qa/testFixtures/src/main/resources/date.csv-spec

+15-9
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ null
344344

345345
docsDateDiff#[skip:-8.12.99, reason:date_diff added in 8.13]
346346
// tag::docsDateDiff[]
347-
ROW date1 = TO_DATETIME("2023-12-02T11:00:00.000Z"), date2 = TO_DATETIME("2023-12-02T11:00:00.001Z")
347+
ROW date1 = TO_DATETIME("2023-12-02T11:00:00.000Z"),
348+
date2 = TO_DATETIME("2023-12-02T11:00:00.001Z")
348349
| EVAL dd_ms = DATE_DIFF("microseconds", date1, date2)
349350
// end::docsDateDiff[]
350351
;
@@ -425,12 +426,12 @@ evalDateDiffYearForDocs
425426
required_capability: date_diff_year_calendarial
426427

427428
// tag::evalDateDiffYearForDocs[]
428-
ROW end_23=TO_DATETIME("2023-12-31T23:59:59.999Z"),
429-
start_24=TO_DATETIME("2024-01-01T00:00:00.000Z"),
430-
end_24=TO_DATETIME("2024-12-31T23:59:59.999")
431-
| EVAL end23_to_start24=DATE_DIFF("year", end_23, start_24)
432-
| EVAL end23_to_end24=DATE_DIFF("year", end_23, end_24)
433-
| EVAL start_to_end_24=DATE_DIFF("year", start_24, end_24)
429+
ROW end_23 = TO_DATETIME("2023-12-31T23:59:59.999Z"),
430+
start_24 = TO_DATETIME("2024-01-01T00:00:00.000Z"),
431+
end_24 = TO_DATETIME("2024-12-31T23:59:59.999")
432+
| EVAL end23_to_start24 = DATE_DIFF("year", end_23, start_24)
433+
| EVAL end23_to_end24 = DATE_DIFF("year", end_23, end_24)
434+
| EVAL start_to_end_24 = DATE_DIFF("year", start_24, end_24)
434435
// end::evalDateDiffYearForDocs[]
435436
;
436437

@@ -1002,7 +1003,8 @@ date:date | year:long
10021003
docsDateExtractBusinessHours
10031004
// tag::docsDateExtractBusinessHours[]
10041005
FROM sample_data
1005-
| WHERE DATE_EXTRACT("hour_of_day", @timestamp) < 9 AND DATE_EXTRACT("hour_of_day", @timestamp) >= 17
1006+
| WHERE DATE_EXTRACT("hour_of_day", @timestamp) < 9
1007+
AND DATE_EXTRACT("hour_of_day", @timestamp) >= 17
10061008
// end::docsDateExtractBusinessHours[]
10071009
;
10081010

@@ -1214,16 +1216,20 @@ required_capability: agg_values
12141216
mvAppendDates
12151217
required_capability: fn_mv_append
12161218

1219+
// tag::mv_append_date[]
12171220
FROM employees
12181221
| WHERE emp_no == 10039 OR emp_no == 10040
12191222
| SORT emp_no
1220-
| EVAL dates = mv_append(birth_date, hire_date)
1223+
| EVAL dates = MV_APPEND(birth_date, hire_date)
12211224
| KEEP emp_no, birth_date, hire_date, dates
1225+
// end::mv_append_date[]
12221226
;
12231227

1228+
// tag::mv_append_date-result[]
12241229
emp_no:integer | birth_date:date | hire_date:date | dates:date
12251230
10039 | 1959-10-01T00:00:00Z | 1988-01-19T00:00:00Z | [1959-10-01T00:00:00Z, 1988-01-19T00:00:00Z]
12261231
10040 | null | 1993-02-14T00:00:00Z | null
1232+
// end::mv_append_date-result[]
12271233
;
12281234

12291235

x-pack/plugin/esql/qa/testFixtures/src/main/resources/date_nanos.csv-spec

+9-1
Original file line numberDiff line numberDiff line change
@@ -619,11 +619,19 @@ date nanos less than
619619
required_capability: to_date_nanos
620620
required_capability: date_nanos_binary_comparison
621621

622-
FROM date_nanos | WHERE MV_MIN(nanos) < TO_DATE_NANOS("2023-10-23T12:27:28.948Z") AND millis > "2000-01-01" | SORT nanos DESC;
622+
// tag::to_date_nanos[]
623+
FROM date_nanos
624+
| WHERE MV_MIN(nanos) < TO_DATE_NANOS("2023-10-23T12:27:28.948Z")
625+
AND millis > "2000-01-01"
626+
| SORT nanos DESC
627+
// end::to_date_nanos[]
628+
;
623629

630+
// tag::to_date_nanos-result[]
624631
millis:date | nanos:date_nanos | num:long
625632
2023-10-23T12:15:03.360Z | 2023-10-23T12:15:03.360103847Z | 1698063303360103847
626633
2023-10-23T12:15:03.360Z | 2023-10-23T12:15:03.360103847Z | 1698063303360103847
634+
// end::to_date_nanos-result[]
627635
;
628636

629637
date nanos less than, no mv min

x-pack/plugin/esql/qa/testFixtures/src/main/resources/ip.csv-spec

+2-2
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ beta | 127.0.0.1
548548
ipPrefix
549549
required_capability: fn_ip_prefix
550550
//tag::ipPrefix[]
551-
row ip4 = to_ip("1.2.3.4"), ip6 = to_ip("fe80::cae2:65ff:fece:feb9")
552-
| eval ip4_prefix = ip_prefix(ip4, 24, 0), ip6_prefix = ip_prefix(ip6, 0, 112);
551+
ROW ip4 = to_ip("1.2.3.4"), ip6 = TO_IP("fe80::cae2:65ff:fece:feb9")
552+
| EVAL ip4_prefix = IP_PREFIX(ip4, 24, 0), ip6_prefix = IP_PREFIX(ip6, 0, 112);
553553
//end::ipPrefix[]
554554

555555
//tag::ipPrefix-result[]

0 commit comments

Comments
 (0)