SQL
- class elasticsearch.client.SqlClient(client)
- Parameters:
client (BaseClient)
- clear_cursor(*, cursor=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)
Clears the SQL cursor
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/clear-sql-cursor-api.html
- delete_async(*, id, error_trace=None, filter_path=None, human=None, pretty=None)
Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-async-sql-search-api.html
- get_async(*, id, delimiter=None, error_trace=None, filter_path=None, format=None, human=None, keep_alive=None, pretty=None, wait_for_completion_timeout=None)
Returns the current status and available results for an async SQL search or stored synchronous SQL search
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-async-sql-search-api.html
- Parameters:
id (str) – Identifier for the search.
delimiter (str | None) – Separator for CSV results. The API only supports this parameter for CSV responses.
format (str | None) – 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.
keep_alive (str | Literal[-1] | ~typing.Literal[0] | None) – Retention period for the search and its results. Defaults to the keep_alive period for the original SQL search.
wait_for_completion_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- get_async_status(*, id, error_trace=None, filter_path=None, human=None, pretty=None)
Returns the current status of an async SQL search or a stored synchronous SQL search
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-async-sql-search-status-api.html
- query(*, catalog=None, columnar=None, cursor=None, error_trace=None, fetch_size=None, field_multi_value_leniency=None, filter=None, filter_path=None, format=None, human=None, index_using_frozen=None, keep_alive=None, keep_on_completion=None, page_timeout=None, params=None, pretty=None, query=None, request_timeout=None, runtime_mappings=None, time_zone=None, wait_for_completion_timeout=None, body=None)
Executes a SQL request
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/sql-search-api.html
- Parameters:
catalog (str | None) – Default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only.
columnar (bool | None) – If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results.
cursor (str | None) – Cursor used to retrieve a set of paginated results. If you specify a cursor, the API only uses the columnar and time_zone request body parameters. It ignores other request body parameters.
fetch_size (int | None) – The maximum number of rows (or entries) to return in one response
field_multi_value_leniency (bool | None) – Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order).
filter (Mapping[str, Any] | None) – Elasticsearch query DSL for additional filtering.
format (str | Literal['cbor', 'csv', 'json', 'smile', 'tsv', 'txt', 'yaml'] | None) – Format for the response.
index_using_frozen (bool | None) – If true, the search can run on frozen indices. Defaults to false.
keep_alive (str | Literal[-1] | ~typing.Literal[0] | None) – Retention period for an async or saved synchronous search.
keep_on_completion (bool | None) – If true, Elasticsearch stores synchronous searches if you also specify the wait_for_completion_timeout parameter. If false, Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout.
page_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – The timeout before a pagination request fails.
params (Mapping[str, Any] | None) – Values for parameters in the query.
query (str | None) – SQL query to run.
request_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – The timeout before the request fails.
runtime_mappings (Mapping[str, Mapping[str, Any]] | None) – Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.
time_zone (str | None) – ISO-8601 time zone ID for the search.
wait_for_completion_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- translate(*, query=None, error_trace=None, fetch_size=None, filter=None, filter_path=None, human=None, pretty=None, time_zone=None, body=None)
Translates SQL into Elasticsearch queries
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/sql-translate-api.html
- Parameters:
query (str | None) – SQL query to run.
fetch_size (int | None) – The maximum number of rows (or entries) to return in one response.
filter (Mapping[str, Any] | None) – Elasticsearch query DSL for additional filtering.
time_zone (str | None) – ISO-8601 time zone ID for the search.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type: