Skip to content

Commit 28adc40

Browse files
lcawlmarciw
andauthoredJan 9, 2025
Add SQL API examples (#3479)
Co-authored-by: Marci W <333176+marciw@users.noreply.github.com>
1 parent 41ea741 commit 28adc40

17 files changed

+539
-409
lines changed
 

‎output/openapi/elasticsearch-openapi.json

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

‎output/openapi/elasticsearch-serverless-openapi.json

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

‎output/schema/schema.json

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

‎output/typescript/types.ts

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

‎specification/_doc_ids/table.csv

+7-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ ccs-network-delays,https://www.elastic.co/guide/en/elasticsearch/reference/{bran
6767
clean-up-snapshot-repo,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/snapshots-register-repository.html#snapshots-repository-cleanup
6868
clear-repositories-metering-archive-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-repositories-metering-archive-api.html
6969
clear-scroll-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-scroll-api.html
70-
clear-sql-cursor-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-sql-cursor-api.html
7170
cluster-allocation-explain,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-allocation-explain.html
7271
cluster-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-get-settings.html
7372
cluster-health,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-health.html
@@ -130,7 +129,6 @@ data-streams,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/da
130129
date-index-name-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/date-index-name-processor.html
131130
dcg,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-rank-eval.html#_discounted_cumulative_gain_dcg
132131
defining-roles,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/defining-roles.html
133-
delete-async-sql-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-async-sql-search-api.html
134132
delete-enrich-policy-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-enrich-policy-api.html
135133
delete-license,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-license.html
136134
delete-pipeline-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-pipeline-api.html
@@ -188,8 +186,6 @@ geo-shape,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/geo-s
188186
geo-grid-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/ingest-geo-grid-processor.html
189187
geoip-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/geoip-processor.html
190188
geoip-stats-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/geoip-stats-api.html
191-
get-async-sql-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-api.html
192-
get-async-sql-search-status-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-status-api.html
193189
get-basic-status,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-basic-status.html
194190
get-dfanalytics-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-dfanalytics-stats.html
195191
get-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-dfanalytics.html
@@ -489,6 +485,8 @@ reroute-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branc
489485
render-search-template-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/render-search-template-api.html
490486
reset-transform,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/reset-transform.html
491487
restore-snapshot,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/snapshots-restore-snapshot.html
488+
sql-delete-async-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-async-sql-search-api.html
489+
sql-clear-cursor-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/clear-sql-cursor-api.html
492490
rollup-agg-limitations,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-agg-limitations.html
493491
rollup-delete-job,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-delete-job.html
494492
rollup-get-job,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/rollup-get-job.html
@@ -694,9 +692,13 @@ sort-search-results,https://www.elastic.co/guide/en/elasticsearch/reference/{bra
694692
sort-tiebreaker,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/eql.html#eql-search-specify-a-sort-tiebreaker
695693
query-dsl-sparse-vector-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/query-dsl-sparse-vector-query.html
696694
split-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/split-processor.html
695+
sql-async-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-api.html
696+
sql-async-status-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-async-sql-search-status-api.html
697+
sql-rest-columnar,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-columnar.html
697698
sql-rest-filtering,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-filtering.html
698699
sql-rest-format,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-rest-format.html
699700
sql-search-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-search-api.html
701+
sql-spec,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-spec.html
700702
sql-translate-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/sql-translate-api.html
701703
start-basic,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/start-basic.html
702704
start-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/start-dfanalytics.html
@@ -719,6 +721,7 @@ tasks,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/tasks.htm
719721
templating-role-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/field-and-document-access-control.html#templating-role-query
720722
terminate-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/terminate-processor.html
721723
time-value,https://github.com/elastic/elasticsearch/blob/{branch}/libs/core/src/main/java/org/elasticsearch/core/TimeValue.java
724+
time-zone-id,https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html
722725
trim-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/trim-processor.html
723726
unfreeze-index-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/unfreeze-index-api.html
724727
update-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/update-dfanalytics.html

‎specification/sql/clear_cursor/ClearSqlCursorRequest.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { RequestBase } from '@_types/Base'
2424
* @rest_spec_name sql.clear_cursor
2525
* @availability stack since=6.3.0 stability=stable
2626
* @availability serverless stability=stable visibility=public
27+
* @doc_id sql-clear-cursor-api
2728
*/
2829
export interface Request extends RequestBase {
2930
body: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# summary:
2+
# method_request: POST _sql/close
3+
description: Run `POST _sql/close` to clear an SQL search cursor.
4+
# type: request
5+
value:
6+
"{\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\
7+
\n}"

‎specification/sql/delete_async/SqlDeleteAsyncRequest.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ import { Id } from '@_types/common'
2424
* Delete an async SQL search.
2525
* Delete an async SQL search or a stored synchronous SQL search.
2626
* If the search is still running, the API cancels it.
27+
*
28+
* If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:
29+
*
30+
* * Users with the `cancel_task` cluster privilege.
31+
* * The user who first submitted the search.
2732
* @rest_spec_name sql.delete_async
2833
* @availability stack since=7.15.0 stability=stable
2934
* @availability serverless stability=stable visibility=public
35+
* @cluster_privileges cancel_task
36+
* @doc_id sql-delete-async-api
3037
*/
3138
export interface Request extends RequestBase {
3239
path_parts: {
3340
/**
34-
* Identifier for the search.
41+
* The identifier for the search.
3542
*/
3643
id: Id
3744
}

‎specification/sql/get_async/SqlGetAsyncRequest.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,41 @@ import { Duration } from '@_types/Time'
2424
/**
2525
* Get async SQL search results.
2626
* Get the current status and available results for an async SQL search or stored synchronous SQL search.
27+
*
28+
* If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.
2729
* @rest_spec_name sql.get_async
2830
* @availability stack since=7.15.0 stability=stable
2931
* @availability serverless stability=stable visibility=public
32+
* @doc_id sql-async-search-api
3033
*/
3134
export interface Request extends RequestBase {
3235
path_parts: {
3336
/**
34-
* Identifier for the search.
37+
* The identifier for the search.
3538
*/
3639
id: Id
3740
}
3841
query_parameters: {
3942
/**
40-
* Separator for CSV results. The API only supports this parameter for CSV responses.
43+
* The separator for CSV results.
44+
* The API supports this parameter only for CSV responses.
4145
* @server_default ,
4246
*/
4347
delimiter?: string
4448
/**
45-
* Format for the response. You must specify a format using this parameter or the
46-
* Accept HTTP header. If you specify both, the API uses this parameter.
49+
* The format for the response.
50+
* You must specify a format using this parameter or the `Accept` HTTP header.
51+
* If you specify both, the API uses this parameter.
4752
*/
4853
format?: string
4954
/**
50-
* Retention period for the search and its results. Defaults
51-
* to the `keep_alive` period for the original SQL search.
55+
* The retention period for the search and its results.
56+
* It defaults to the `keep_alive` period for the original SQL search.
5257
*/
5358
keep_alive?: Duration
5459
/**
55-
* Period to wait for complete results. Defaults to no timeout,
56-
* meaning the request waits for complete search results.
60+
* The period to wait for complete results.
61+
* It defaults to no timeout, meaning the request waits for complete search results.
5762
*/
5863
wait_for_completion_timeout?: Duration
5964
}

‎specification/sql/get_async/SqlGetAsyncResponse.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ import { Column, Row } from '../types'
2323
export class Response {
2424
body: {
2525
/**
26-
* Identifier for the search. This value is only returned for async and saved
27-
* synchronous searches. For CSV, TSV, and TXT responses, this value is returned
28-
* in the `Async-ID` HTTP header.
26+
* Identifier for the search.
27+
* This value is returned only for async and saved synchronous searches.
28+
* For CSV, TSV, and TXT responses, this value is returned in the `Async-ID` HTTP header.
2929
*/
3030
id: Id
3131
/**
32-
* If `true`, the search is still running. If false, the search has finished.
33-
* This value is only returned for async and saved synchronous searches. For
34-
* CSV, TSV, and TXT responses, this value is returned in the `Async-partial`
35-
* HTTP header.
32+
* If `true`, the search is still running.
33+
* If `false`, the search has finished.
34+
* This value is returned only for async and saved synchronous searches.
35+
* For CSV, TSV, and TXT responses, this value is returned in the `Async-partial` HTTP header.
3636
*/
3737
is_running: boolean
3838
/**
39-
* If `true`, the response does not contain complete search results. If `is_partial`
40-
* is `true` and `is_running` is `true`, the search is still running. If `is_partial`
41-
* is `true` but `is_running` is `false`, the results are partial due to a failure or
42-
* timeout. This value is only returned for async and saved synchronous searches.
39+
* If `true`, the response does not contain complete search results.
40+
* If `is_partial` is `true` and `is_running` is `true`, the search is still running.
41+
* If `is_partial` is `true` but `is_running` is `false`, the results are partial due to a failure or timeout.
42+
* This value is returned only for async and saved synchronous searches.
4343
* For CSV, TSV, and TXT responses, this value is returned in the `Async-partial` HTTP header.
4444
*/
4545
is_partial: boolean
@@ -48,12 +48,12 @@ export class Response {
4848
*/
4949
columns?: Column[]
5050
/**
51-
* Cursor for the next set of paginated results. For CSV, TSV, and
52-
* TXT responses, this value is returned in the `Cursor` HTTP header.
51+
* The cursor for the next set of paginated results.
52+
* For CSV, TSV, and TXT responses, this value is returned in the `Cursor` HTTP header.
5353
*/
5454
cursor?: string
5555
/**
56-
* Values for the search results.
56+
* The values for the search results.
5757
*/
5858
rows: Row[]
5959
}

‎specification/sql/get_async_status/SqlGetAsyncStatusRequest.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ import { Id } from '@_types/common'
2626
* @rest_spec_name sql.get_async_status
2727
* @availability stack since=7.15.0 stability=stable
2828
* @availability serverless stability=stable visibility=public
29+
* @cluster_privileges monitor
30+
* @doc_id sql-async-status-api
2931
*/
3032
export interface Request extends RequestBase {
3133
path_parts: {
3234
/**
33-
* Identifier for the search.
35+
* The identifier for the search.
3436
*/
3537
id: Id
3638
}

‎specification/sql/get_async_status/SqlGetAsyncStatusResponse.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@ import { EpochTime, UnitMillis } from '@_types/Time'
2323
export class Response {
2424
body: {
2525
/**
26-
* Identifier for the search.
26+
* The timestamp, in milliseconds since the Unix epoch, when Elasticsearch will delete the search and its results, even if the search is still running.
27+
*/
28+
expiration_time_in_millis: EpochTime<UnitMillis>
29+
/**
30+
* The identifier for the search.
2731
*/
2832
id: string
2933
/**
30-
* If `true`, the search is still running. If `false`, the search has finished.
34+
* If `true`, the search is still running.
35+
* If `false`, the search has finished.
3136
*/
3237
is_running: boolean
3338
/**
34-
* If `true`, the response does not contain complete search results. If `is_partial`
35-
* is `true` and `is_running` is `true`, the search is still running. If `is_partial`
36-
* is `true` but `is_running` is `false`, the results are partial due to a failure or
37-
* timeout.
39+
* If `true`, the response does not contain complete search results.
40+
* If `is_partial` is `true` and `is_running` is `true`, the search is still running.
41+
* If `is_partial` is `true` but `is_running` is `false`, the results are partial due to a failure or timeout.
3842
*/
3943
is_partial: boolean
4044
/**
41-
* Timestamp, in milliseconds since the Unix epoch, when the search started.
42-
* The API only returns this property for running searches.
45+
* The timestamp, in milliseconds since the Unix epoch, when the search started.
46+
* The API returns this property only for running searches.
4347
*/
4448
start_time_in_millis: EpochTime<UnitMillis>
4549
/**
46-
* Timestamp, in milliseconds since the Unix epoch, when Elasticsearch will delete
47-
* the search and its results, even if the search is still running.
48-
*/
49-
expiration_time_in_millis: EpochTime<UnitMillis>
50-
/**
51-
* HTTP status code for the search. The API only returns this property for completed searches.
50+
* The HTTP status code for the search.
51+
* The API returns this property only for completed searches.
5252
*/
5353
completion_status?: uint
5454
}

0 commit comments

Comments
 (0)