This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
SQL translate API
editSQL translate API
editTranslates an SQL search into a search API request containing Query DSL. See SQL Translate API.
resp = client.sql.translate( query="SELECT * FROM library ORDER BY page_count DESC", fetch_size=10, ) print(resp)
const response = await client.sql.translate({ query: "SELECT * FROM library ORDER BY page_count DESC", fetch_size: 10, }); console.log(response);
POST _sql/translate { "query": "SELECT * FROM library ORDER BY page_count DESC", "fetch_size": 10 }
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have the
read
index privilege for the data stream, index, or alias you search.
Limitations
editSee SQL Limitations.
Request body
editThe SQL translate API accepts the same request body parameters as the
SQL search API, excluding cursor
.
Response body
editThe SQL translate API returns the same response body as the search API.