Skip to content

Commit 71b276d

Browse files
authored
ESQL: Add version to docs (#107225)
Docs for #106824. Does not cover the [REST API specs](https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json) as these don't cover the request body.
1 parent 212e203 commit 71b276d

File tree

6 files changed

+90
-17
lines changed

6 files changed

+90
-17
lines changed

docs/reference/esql/esql-async-query-api.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ POST /_query/async
2424
| SORT year
2525
| LIMIT 5
2626
""",
27-
"wait_for_completion_timeout": "2s"
27+
"wait_for_completion_timeout": "2s",
28+
"version": "2024.04.01"
2829
}
2930
----
3031
// TEST[setup:library]

docs/reference/esql/esql-query-api.asciidoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ POST /_query
1616
| STATS MAX(page_count) BY year
1717
| SORT year
1818
| LIMIT 5
19-
"""
19+
""",
20+
"version": "2024.04.01"
2021
}
2122
----
2223
// TEST[setup:library]
@@ -76,7 +77,11 @@ For syntax, refer to <<esql-locale-param>>.
7677
<<esql-rest-params>>.
7778

7879
`query`::
79-
(Required, object) {esql} query to run. For syntax, refer to <<esql-syntax>>.
80+
(Required, string) {esql} query to run. For syntax, refer to <<esql-syntax>>.
81+
82+
`version`::
83+
(Required, string) {esql} language version. Can be sent in short or long form, e.g.
84+
`2024.04.01` or `2024.04.01.🚀`. See <<esql-version>> for details.
8085

8186
[discrete]
8287
[role="child_attributes"]

docs/reference/esql/esql-rest.asciidoc

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ The <<esql-query-api,{esql} query API>> accepts an {esql} query string in the
1616
----
1717
POST /_query?format=txt
1818
{
19-
"query": "FROM library | KEEP author, name, page_count, release_date | SORT page_count DESC | LIMIT 5"
19+
"query": "FROM library | KEEP author, name, page_count, release_date | SORT page_count DESC | LIMIT 5",
20+
"version": "2024.04.01"
2021
}
2122
----
2223
// TEST[setup:library]
@@ -55,7 +56,8 @@ POST /_query?format=txt
5556
| KEEP author, name, page_count, release_date
5657
| SORT page_count DESC
5758
| LIMIT 5
58-
"""
59+
""",
60+
"version": "2024.04.01"
5961
}
6062
----
6163
// TEST[setup:library]
@@ -143,7 +145,8 @@ POST /_query?format=txt
143145
"lte": 200
144146
}
145147
}
146-
}
148+
},
149+
"version": "2024.04.01"
147150
}
148151
----
149152
// TEST[setup:library]
@@ -179,7 +182,8 @@ POST /_query?format=json
179182
| SORT page_count DESC
180183
| LIMIT 5
181184
""",
182-
"columnar": true
185+
"columnar": true,
186+
"version": "2024.04.01"
183187
}
184188
----
185189
// TEST[setup:library]
@@ -226,7 +230,8 @@ POST /_query
226230
| EVAL birth_date = date_parse(birth_date_string)
227231
| EVAL month_of_birth = DATE_FORMAT("MMMM",birth_date)
228232
| LIMIT 5
229-
"""
233+
""",
234+
"version": "2024.04.01"
230235
}
231236
----
232237
// TEST[setup:library]
@@ -249,7 +254,8 @@ POST /_query
249254
| STATS count = COUNT(*) by year
250255
| WHERE count > 0
251256
| LIMIT 5
252-
"""
257+
""",
258+
"version": "2024.04.01"
253259
}
254260
----
255261
// TEST[setup:library]
@@ -270,7 +276,8 @@ POST /_query
270276
| WHERE count > ?
271277
| LIMIT 5
272278
""",
273-
"params": [300, "Frank Herbert", 0]
279+
"params": [300, "Frank Herbert", 0],
280+
"version": "2024.04.01"
274281
}
275282
----
276283
// TEST[setup:library]
@@ -304,7 +311,8 @@ POST /_query/async
304311
| SORT year
305312
| LIMIT 5
306313
""",
307-
"wait_for_completion_timeout": "2s"
314+
"wait_for_completion_timeout": "2s",
315+
"version": "2024.04.01"
308316
}
309317
----
310318
// TEST[setup:library]

docs/reference/esql/esql-using.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Using {esql} to query across multiple clusters.
1818
<<esql-task-management>>::
1919
Using the <<tasks,task management API>> to list and cancel {esql} queries.
2020

21+
<<esql-version>>::
22+
Information about {esql} language versions.
23+
2124
include::esql-rest.asciidoc[]
2225
include::esql-kibana.asciidoc[]
2326
include::esql-security-solution.asciidoc[]
2427
include::esql-across-clusters.asciidoc[]
2528
include::task-management.asciidoc[]
29+
include::esql-version.asciidoc[]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[[esql-version]]
2+
=== {esql} language versions
3+
4+
++++
5+
<titleabbrev>Language versions</titleabbrev>
6+
++++
7+
8+
[discrete]
9+
[[esql-versions-released]]
10+
==== Released versions
11+
12+
* Version `2024.04.01`
13+
14+
[discrete]
15+
[[esql-versions-explanation]]
16+
=== How versions work
17+
18+
{esql} language versions are independent of {es} versions.
19+
Versioning the language ensures that your queries will always
20+
remain valid, independent of new {es} and {esql} releases. And it lets us
21+
evolve ESQL as we learn more from people using it. We don't plan to make
22+
huge changes to it, but we know we've made mistakes and we don't want those
23+
to live forever.
24+
25+
For instance, the following query will remain valid, even if a future
26+
version of {esql} introduces syntax changes or changes how the used
27+
commands or functions work.
28+
29+
[source,console]
30+
----
31+
POST /_query?format=txt
32+
{
33+
"version": "2024.04.01",
34+
"query": """
35+
FROM library
36+
| EVAL release_month = DATE_TRUNC(1 month, release_date)
37+
| KEEP release_month
38+
| SORT release_month ASC
39+
| LIMIT 3
40+
"""
41+
}
42+
----
43+
// TEST[setup:library]
44+
45+
We won't make breaking changes to released {esql} versions and
46+
versions will remain supported until they are deprecated.
47+
New features, bug fixes, and performance improvements
48+
will be continue to be added to released {esql} versions,
49+
provided they do not involve breaking changes.

docs/reference/esql/multivalued-fields.asciidoc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ POST /mv/_bulk?refresh
1717
1818
POST /_query
1919
{
20-
"query": "FROM mv | LIMIT 2"
20+
"query": "FROM mv | LIMIT 2",
21+
"version": "2024.04.01"
2122
}
2223
----
2324

@@ -65,7 +66,8 @@ POST /mv/_bulk?refresh
6566
6667
POST /_query
6768
{
68-
"query": "FROM mv | LIMIT 2"
69+
"query": "FROM mv | LIMIT 2",
70+
"version": "2024.04.01"
6971
}
7072
----
7173

@@ -106,7 +108,8 @@ POST /mv/_bulk?refresh
106108
107109
POST /_query
108110
{
109-
"query": "FROM mv | LIMIT 2"
111+
"query": "FROM mv | LIMIT 2",
112+
"version": "2024.04.01"
110113
}
111114
----
112115

@@ -148,7 +151,8 @@ POST /mv/_bulk?refresh
148151
149152
POST /_query
150153
{
151-
"query": "FROM mv | EVAL b=TO_STRING(b) | LIMIT 2"
154+
"query": "FROM mv | EVAL b=TO_STRING(b) | LIMIT 2",
155+
"version": "2024.04.01"
152156
}
153157
----
154158

@@ -186,7 +190,8 @@ POST /mv/_bulk?refresh
186190
----
187191
POST /_query
188192
{
189-
"query": "FROM mv | EVAL b + 2, a + b | LIMIT 4"
193+
"query": "FROM mv | EVAL b + 2, a + b | LIMIT 4",
194+
"version": "2024.04.01"
190195
}
191196
----
192197
// TEST[continued]
@@ -225,7 +230,8 @@ Work around this limitation by converting the field to single value with one of:
225230
----
226231
POST /_query
227232
{
228-
"query": "FROM mv | EVAL b=MV_MIN(b) | EVAL b + 2, a + b | LIMIT 4"
233+
"query": "FROM mv | EVAL b=MV_MIN(b) | EVAL b + 2, a + b | LIMIT 4",
234+
"version": "2024.04.01"
229235
}
230236
----
231237
// TEST[continued]

0 commit comments

Comments
 (0)