Skip to content

Commit 0e17e43

Browse files
[Backport 8.0] Add async SQL APIs (#1314)
Co-authored-by: Seth Michael Larson <[email protected]>
1 parent 627eab6 commit 0e17e43

File tree

11 files changed

+813
-49
lines changed

11 files changed

+813
-49
lines changed

output/schema/schema.json

Lines changed: 474 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 47 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Id } from '@_types/common'
22+
23+
/**
24+
* @rest_spec_name sql.delete_async
25+
* @since 7.15.0
26+
* @stability stable
27+
*/
28+
export interface Request extends RequestBase {
29+
path_parts: {
30+
id: Id
31+
}
32+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response extends AcknowledgedResponseBase {}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Time } from '@_types/Time'
21+
import { RequestBase } from '@_types/Base'
22+
import { Id } from '@_types/common'
23+
24+
/**
25+
* @rest_spec_name sql.get_async
26+
* @since 7.15.0
27+
* @stability stable
28+
*/
29+
export interface Request extends RequestBase {
30+
path_parts: {
31+
id: Id
32+
}
33+
query_parameters: {
34+
/**
35+
* Separator for CSV results. The API only supports this parameter for CSV responses.
36+
* @server_default ,
37+
*/
38+
delimiter?: string
39+
/**
40+
* Format for the response. You must specify a format using this parameter or the
41+
* Accept HTTP header. If you specify both, the API uses this parameter.
42+
*/
43+
format?: string
44+
/**
45+
* Retention period for the search and its results. Defaults
46+
* to the `keep_alive` period for the original SQL search.
47+
*/
48+
keep_alive?: Time
49+
/**
50+
* Period to wait for complete results. Defaults to no timeout,
51+
* meaning the request waits for complete search results.
52+
*/
53+
wait_for_completion_timeout?: Time
54+
}
55+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Id } from '@_types/common'
21+
import { Column, Row } from '../types'
22+
23+
export class Response {
24+
body: {
25+
/**
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.
29+
*/
30+
id: Id
31+
/**
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.
36+
*/
37+
is_running: boolean
38+
/**
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.
43+
* For CSV, TSV, and TXT responses, this value is returned in the `Async-partial` HTTP header.
44+
*/
45+
is_partial: boolean
46+
/**
47+
* Column headings for the search results. Each object is a column.
48+
*/
49+
columns?: Column[]
50+
/**
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.
53+
*/
54+
cursor?: string
55+
/**
56+
* Values for the search results.
57+
*/
58+
rows: Row[]
59+
}
60+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Time } from '@_types/Time'
21+
import { RequestBase } from '@_types/Base'
22+
import { Id } from '@_types/common'
23+
24+
/**
25+
* @rest_spec_name sql.get_async_status
26+
* @since 7.15.0
27+
* @stability stable
28+
*/
29+
export interface Request extends RequestBase {
30+
path_parts: {
31+
id: Id
32+
}
33+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { uint, ulong } from '@_types/Numeric'
21+
22+
export class Response {
23+
body: {
24+
/**
25+
* Identifier for the search.
26+
*/
27+
id: string
28+
/**
29+
* If `true`, the search is still running. If `false`, the search has finished.
30+
*/
31+
is_running: boolean
32+
/**
33+
* If `true`, the response does not contain complete search results. If `is_partial`
34+
* is `true` and `is_running` is `true`, the search is still running. If `is_partial`
35+
* is `true` but `is_running` is `false`, the results are partial due to a failure or
36+
* timeout.
37+
*/
38+
is_partial: boolean
39+
/**
40+
* Timestamp, in milliseconds since the Unix epoch, when the search started.
41+
* The API only returns this property for running searches.
42+
*/
43+
start_time_in_millis: ulong
44+
/**
45+
* Timestamp, in milliseconds since the Unix epoch, when Elasticsearch will delete
46+
* the search and its results, even if the search is still running.
47+
*/
48+
expiration_time_in_millis: ulong
49+
/**
50+
* HTTP status code for the search. The API only returns this property for completed searches.
51+
*/
52+
completion_status?: uint
53+
}
54+
}

0 commit comments

Comments
 (0)