elasticsearch/docs/reference/sql/apis/sql-translate-api.asciidoc
James Rodewig 07ac8818b6
[DOCS] Remove testenv annotations from doc snippet tests (#80023) (#80458)
Removes `testenv` annotations and related code. These annotations originally let you skip x-pack snippet tests in the docs. However, that's no longer possible.

Relates to #79309, #31619
# Conflicts:
#	docs/reference/ml/df-analytics/apis/get-trained-model-deployment-stats.asciidoc
#	docs/reference/ml/df-analytics/apis/infer-trained-model-deployment.asciidoc
#	docs/reference/ml/df-analytics/apis/put-trained-model-definition-part.asciidoc
#	docs/reference/ml/df-analytics/apis/put-trained-model-vocabulary.asciidoc
#	docs/reference/ml/df-analytics/apis/start-trained-model-deployment.asciidoc
#	docs/reference/ml/df-analytics/apis/stop-trained-model-deployment.asciidoc
#	docs/reference/slm/apis/slm-delete.asciidoc
#	docs/reference/slm/apis/slm-execute-retention.asciidoc
#	docs/reference/slm/apis/slm-execute.asciidoc
#	docs/reference/slm/apis/slm-get-status.asciidoc
#	docs/reference/slm/apis/slm-get.asciidoc
#	docs/reference/slm/apis/slm-start.asciidoc
#	docs/reference/slm/apis/slm-stats.asciidoc
#	docs/reference/slm/apis/slm-stop.asciidoc
#	docs/reference/sql/endpoints/client-apps/tableau-desktop.asciidoc
#	docs/reference/sql/endpoints/client-apps/tableau-server.asciidoc
2021-11-05 19:41:54 -04:00

52 lines
1.2 KiB
Text

[role="xpack"]
[[sql-translate-api]]
=== SQL translate API
++++
<titleabbrev>SQL translate</titleabbrev>
++++
Translates an <<sql-search-api,SQL search>> into a <<search-search,search API>>
request containing <<query-dsl,Query DSL>>. See <<sql-translate>>.
[source,console]
----
POST _sql/translate
{
"query": "SELECT * FROM library ORDER BY page_count DESC",
"fetch_size": 10
}
----
// TEST[setup:library]
[[sql-translate-api-request]]
==== {api-request-title}
`GET _sql/translate`
`POST _sql/translate`
[[sql-translate-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `read`
<<privileges-list-indices,index privilege>> for the data stream, index,
or alias you search.
[[sql-translate-api-limitations]]
===== Limitations
See <<sql-limitations>>.
[role="child_attributes"]
[[sql-translate-api-request-body]]
==== {api-request-body-title}
The SQL translate API accepts the same request body parameters as the
<<sql-search-api-request-body,SQL search API>>, excluding `cursor`.
[role="child_attributes"]
[[sql-translate-api-response-body]]
==== {api-response-body-title}
The SQL translate API returns the same response body as the
<<search-search,search API>>.