Skip to content

[Backport 8.0] Add async SQL APIs #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
512 changes: 474 additions & 38 deletions output/schema/schema.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/schema/validation-errors.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 47 additions & 7 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions specification/sql/delete_async/SqlDeleteAsyncRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'

/**
* @rest_spec_name sql.delete_async
* @since 7.15.0
* @stability stable
*/
export interface Request extends RequestBase {
path_parts: {
id: Id
}
}
22 changes: 22 additions & 0 deletions specification/sql/delete_async/SqlDeleteAsyncResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { AcknowledgedResponseBase } from '@_types/Base'

export class Response extends AcknowledgedResponseBase {}
55 changes: 55 additions & 0 deletions specification/sql/get_async/SqlGetAsyncRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Time } from '@_types/Time'
import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'

/**
* @rest_spec_name sql.get_async
* @since 7.15.0
* @stability stable
*/
export interface Request extends RequestBase {
path_parts: {
id: Id
}
query_parameters: {
/**
* Separator for CSV results. The API only supports this parameter for CSV responses.
* @server_default ,
*/
delimiter?: string
/**
* Format for the response. You must specify a format using this parameter or the
* Accept HTTP header. If you specify both, the API uses this parameter.
*/
format?: string
/**
* Retention period for the search and its results. Defaults
* to the `keep_alive` period for the original SQL search.
*/
keep_alive?: Time
/**
* Period to wait for complete results. Defaults to no timeout,
* meaning the request waits for complete search results.
*/
wait_for_completion_timeout?: Time
}
}
60 changes: 60 additions & 0 deletions specification/sql/get_async/SqlGetAsyncResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Id } from '@_types/common'
import { Column, Row } from '../types'

export class Response {
body: {
/**
* Identifier for the search. This value is only returned for async and saved
* synchronous searches. For CSV, TSV, and TXT responses, this value is returned
* in the `Async-ID` HTTP header.
*/
id: Id
/**
* If `true`, the search is still running. If false, the search has finished.
* This value is only returned for async and saved synchronous searches. For
* CSV, TSV, and TXT responses, this value is returned in the `Async-partial`
* HTTP header.
*/
is_running: boolean
/**
* If `true`, the response does not contain complete search results. If `is_partial`
* is `true` and `is_running` is `true`, the search is still running. If `is_partial`
* is `true` but `is_running` is `false`, the results are partial due to a failure or
* timeout. This value is only returned for async and saved synchronous searches.
* For CSV, TSV, and TXT responses, this value is returned in the `Async-partial` HTTP header.
*/
is_partial: boolean
/**
* Column headings for the search results. Each object is a column.
*/
columns?: Column[]
/**
* Cursor for the next set of paginated results. For CSV, TSV, and
* TXT responses, this value is returned in the `Cursor` HTTP header.
*/
cursor?: string
/**
* Values for the search results.
*/
rows: Row[]
}
}
33 changes: 33 additions & 0 deletions specification/sql/get_async_status/SqlGetAsyncStatusRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Time } from '@_types/Time'
import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'

/**
* @rest_spec_name sql.get_async_status
* @since 7.15.0
* @stability stable
*/
export interface Request extends RequestBase {
path_parts: {
id: Id
}
}
54 changes: 54 additions & 0 deletions specification/sql/get_async_status/SqlGetAsyncStatusResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { uint, ulong } from '@_types/Numeric'

export class Response {
body: {
/**
* Identifier for the search.
*/
id: string
/**
* If `true`, the search is still running. If `false`, the search has finished.
*/
is_running: boolean
/**
* If `true`, the response does not contain complete search results. If `is_partial`
* is `true` and `is_running` is `true`, the search is still running. If `is_partial`
* is `true` but `is_running` is `false`, the results are partial due to a failure or
* timeout.
*/
is_partial: boolean
/**
* Timestamp, in milliseconds since the Unix epoch, when the search started.
* The API only returns this property for running searches.
*/
start_time_in_millis: ulong
/**
* Timestamp, in milliseconds since the Unix epoch, when Elasticsearch will delete
* the search and its results, even if the search is still running.
*/
expiration_time_in_millis: ulong
/**
* HTTP status code for the search. The API only returns this property for completed searches.
*/
completion_status?: uint
}
}
Loading