sql-translate-api.asciidoc 1.2 KB

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