sql-translate-api.asciidoc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. [role="xpack"]
  2. [[sql-translate-api]]
  3. === SQL translate API
  4. ++++
  5. <titleabbrev>SQL translate</titleabbrev>
  6. ++++
  7. Translates an <<sql-search-api,SQL search>> into a <<search-search,search API>>
  8. request containing <<query-dsl,Query DSL>>. See <<sql-translate>>.
  9. [source,console]
  10. ----
  11. POST _sql/translate
  12. {
  13. "query": "SELECT * FROM library ORDER BY page_count DESC",
  14. "fetch_size": 10
  15. }
  16. ----
  17. // TEST[setup:library]
  18. [[sql-translate-api-request]]
  19. ==== {api-request-title}
  20. `GET _sql/translate`
  21. `POST _sql/translate`
  22. [[sql-translate-api-prereqs]]
  23. ==== {api-prereq-title}
  24. * If the {es} {security-features} are enabled, you must have the `read`
  25. <<privileges-list-indices,index privilege>> for the data stream, index,
  26. or alias you search.
  27. [[sql-translate-api-limitations]]
  28. ===== Limitations
  29. See <<sql-limitations>>.
  30. [role="child_attributes"]
  31. [[sql-translate-api-request-body]]
  32. ==== {api-request-body-title}
  33. The SQL translate API accepts the same request body parameters as the
  34. <<sql-search-api-request-body,SQL search API>>, excluding `cursor`.
  35. [role="child_attributes"]
  36. [[sql-translate-api-response-body]]
  37. ==== {api-response-body-title}
  38. The SQL translate API returns the same response body as the
  39. <<search-search,search API>>.