Skip to content

Commit 7f9895d

Browse files
bpinteajrodewig
andauthored
SQL: Add CCS SQL documentation (#81545) (#82282)
This adds the documentation for CCS SQL. Co-authored-by: James Rodewig <[email protected]> (cherry picked from commit 13a0e42)
1 parent 5b3b52a commit 7f9895d

File tree

14 files changed

+134
-35
lines changed

14 files changed

+134
-35
lines changed

docs/reference/search/search-your-data/search-across-clusters.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ The following APIs support {ccs}:
1919
* <<search-template,Search template>>
2020
* <<multi-search-template,Multi search template>>
2121
* <<search-field-caps,Field capabilities>>
22-
* <<sql-search-api,SQL search>>
2322
* experimental:[] <<eql-search-api,EQL search>>
23+
* experimental:[] <<sql-search-api,SQL search>>
2424
* <<search-vector-tile-api,Vector tile search>>
2525

2626
[discrete]

docs/reference/sql/apis/sql-search-api.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ precedence.
5454
[[sql-search-api-request-body]]
5555
==== {api-request-body-title}
5656

57+
`catalog`::
58+
(Optional, string) Default catalog (cluster) for queries. If unspecified, the
59+
queries execute on the data in the local cluster only.
60+
+
61+
experimental:[] See <<modules-cross-cluster-search,{ccs}>>.
62+
5763
`columnar`::
5864
(Optional, Boolean) If `true`, returns results in a columnar format. Defaults to
5965
`false`. The API only supports this parameter for CBOR, JSON, SMILE, and YAML

docs/reference/sql/endpoints/jdbc.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ will be - typically the first in natural ascending order) for fields with multip
148148
==== Index
149149
`index.include.frozen` (default `false`):: Whether to include <<freeze-index-api, frozen-indices>> in the query execution or not (default).
150150

151+
[discrete]
152+
==== Cluster
153+
`catalog`:: Default catalog (cluster) for queries. If unspecified, the
154+
queries execute on the data in the local cluster only.
155+
+
156+
experimental:[] See <<modules-cross-cluster-search,{ccs}>>.
157+
151158
[discrete]
152159
==== Additional
153160

docs/reference/sql/language/indices.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[fromTablePatternQuoted]
3434

3535
NOTE: There is the restriction that all resolved concrete tables have the exact same mapping.
3636

37+
experimental:[] To run a <<modules-cross-cluster-search,{ccs}>>, specify a
38+
cluster name using the `<remote_cluster>:<target>` syntax, where
39+
`<remote_cluster>` maps to a SQL catalog (cluster) and `<target>` to a table
40+
(index or data stream). The `<remote_cluster>` supports wildcards (`*`)
41+
and `<target>` can be an index pattern.
42+
43+
For example:
44+
45+
[source, sql]
46+
----
47+
include-tagged::{sql-specs}/multi-cluster-with-security/multi-cluster-docs.csv-spec[fromQualifiedTableQuoted]
48+
----
49+
3750
[[sql-index-patterns-like]]
3851
[discrete]
3952
==== SQL `LIKE` notation

docs/reference/sql/language/syntax/commands/describe-table.asciidoc

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,17 @@
55
.Synopsis:
66
[source, sql]
77
----
8-
DESCRIBE
9-
[table identifier | <1>
10-
[LIKE pattern]] <2>
8+
DESCRIBE | DESC
9+
[CATALOG identifier]? <1>
10+
[INCLUDE FROZEN]? <2>
11+
[table_identifier | <3>
12+
LIKE pattern] <4>
1113
----
1214

13-
<1> single table identifier or double quoted es multi index
14-
<2> SQL LIKE pattern
15-
16-
or
17-
18-
[source, sql]
19-
----
20-
DESC
21-
[table identifier | <1>
22-
[LIKE pattern]] <2>
23-
----
24-
25-
<1> single table identifier or double quoted es multi index
26-
<2> SQL LIKE pattern
15+
<1> Catalog (cluster) identifier. Supports wildcards (`*`).
16+
<2> Whether or not to include frozen indices.
17+
<3> Single table (index or data stream) identifier or double-quoted multi-target pattern.
18+
<4> SQL LIKE pattern matching table names.
2719

2820
*Description*: `DESC` and `DESCRIBE` are aliases to <<sql-syntax-show-columns>>.
2921

docs/reference/sql/language/syntax/commands/index.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ This section contains the list of SQL commands supported by {es-sql} along with
66

77
<<sql-syntax-describe-table>>:: Describe a table.
88
<<sql-syntax-select>>:: Retrieve rows from zero or more tables.
9+
<<sql-syntax-show-catalogs>>:: List available catalogs.
910
<<sql-syntax-show-columns>>:: List columns in table.
1011
<<sql-syntax-show-functions>>:: List supported functions.
1112
<<sql-syntax-show-tables>>:: List tables available.
1213

1314
include::describe-table.asciidoc[]
1415
include::select.asciidoc[]
16+
include::show-catalogs.asciidoc[]
1517
include::show-columns.asciidoc[]
1618
include::show-functions.asciidoc[]
1719
include::show-tables.asciidoc[]

docs/reference/sql/language/syntax/commands/select.asciidoc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ The name can be a <<multi-index, pattern>> pointing to multiple indices (likely
123123
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTablePatternQuoted]
124124
----
125125

126+
experimental:[] To run a <<modules-cross-cluster-search,{ccs}>>, specify a
127+
cluster name using the `<remote_cluster>:<target>` syntax, where
128+
`<remote_cluster>` maps to a SQL catalog (cluster) and `<target>` to a table
129+
(index or data stream). The `<remote_cluster>` supports wildcards (`*`)
130+
and `<target>` can be an <<sql-index-patterns, index pattern>>.
131+
132+
[source, sql]
133+
----
134+
include-tagged::{sql-specs}/multi-cluster-with-security/multi-cluster-docs.csv-spec[fromQualifiedTableQuoted]
135+
----
136+
126137
`alias`::
127138
A substitute name for the `FROM` item containing the alias. An alias is used for brevity or to eliminate ambiguity. When an alias is provided, it completely hides the actual name of the table and must be used in its place.
128139

@@ -334,7 +345,7 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[orderByBasic]
334345
[[sql-syntax-order-by-grouping]]
335346
==== Order By and Grouping
336347
337-
For queries that perform grouping, ordering can be applied either on the grouping columns (by default ascending) or on aggregate functions.
348+
For queries that perform grouping, ordering can be applied either on the grouping columns (by default ascending) or on aggregate functions.
338349
339350
NOTE: With `GROUP BY`, make sure the ordering targets the resulting group - applying it to individual elements inside the group will have no impact on the results since regardless of the order, values inside the group are aggregated.
340351
@@ -370,7 +381,7 @@ When doing full-text queries in the `WHERE` clause, results can be returned base
370381
371382
NOTE: When doing multiple text queries in the `WHERE` clause then, their scores will be
372383
combined using the same rules as {es}'s
373-
<<query-dsl-bool-query,bool query>>.
384+
<<query-dsl-bool-query,bool query>>.
374385
375386
To sort based on the `score`, use the special function `SCORE()`:
376387
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[role="xpack"]
2+
[[sql-syntax-show-catalogs]]
3+
=== SHOW CATALOGS
4+
5+
.Synopsis:
6+
[source, sql]
7+
----
8+
SHOW CATALOGS
9+
----
10+
11+
*Description*: List the available catalogs and their types.
12+
13+
[source, sql]
14+
----
15+
include-tagged::{sql-specs}/multi-cluster-with-security/multi-cluster-command.csv-spec[showCatalogs]
16+
----
17+

docs/reference/sql/language/syntax/commands/show-columns.asciidoc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
.Synopsis:
66
[source, sql]
77
----
8-
SHOW COLUMNS [ FROM | IN ]?
9-
[table identifier | <1>
10-
[LIKE pattern] ] <2>
8+
SHOW COLUMNS
9+
[CATALOG identifier]? <1>
10+
[INCLUDE FROZEN]? <2>
11+
[FROM | IN]
12+
[table_identifier | <3>
13+
LIKE pattern] <4>
1114
----
1215

13-
<1> single table identifier or double quoted es multi index
14-
<2> SQL LIKE pattern
16+
<1> Catalog (cluster) identifier. Supports wildcards (`*`).
17+
<2> Whether or not to include frozen indices.
18+
<3> Single table (index or data stream) identifier or double-quoted multi-target pattern.
19+
<4> SQL LIKE pattern matching table names.
1520

1621
See <<sql-index-patterns, index patterns>> for more information about
1722
patterns.

docs/reference/sql/language/syntax/commands/show-functions.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.Synopsis:
66
[source, sql]
77
----
8-
SHOW FUNCTIONS [LIKE pattern?]? <1>
8+
SHOW FUNCTIONS [LIKE pattern]? <1>
99
----
1010

1111
<1> SQL match pattern

0 commit comments

Comments
 (0)