esql-query-api.asciidoc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [[esql-query-api]]
  2. == {esql} query API
  3. ++++
  4. <titleabbrev>{esql} query API</titleabbrev>
  5. ++++
  6. Returns search results for an <<esql,ES|QL ({es} query language)>> query.
  7. include::index.asciidoc[tag=esql-query-api-example]
  8. [discrete]
  9. [[esql-query-api-request]]
  10. === {api-request-title}
  11. `POST _query`
  12. [discrete]
  13. [[esql-query-api-prereqs]]
  14. === {api-prereq-title}
  15. * If the {es} {security-features} are enabled, you must have the `read`
  16. <<privileges-list-indices,index privilege>> for the data stream, index,
  17. or alias you search.
  18. [discrete]
  19. [[esql-query-api-query-params]]
  20. === {api-query-parms-title}
  21. `delimiter`::
  22. (Optional, string) Separator for CSV results. Defaults to `,`. The API only
  23. supports this parameter for CSV responses.
  24. `format`::
  25. (Optional, string) Format for the response. For valid values, refer to
  26. <<esql-rest-format>>.
  27. +
  28. You can also specify a format using the `Accept` HTTP header. If you specify
  29. both this parameter and the `Accept` HTTP header, this parameter takes
  30. precedence.
  31. [discrete]
  32. [role="child_attributes"]
  33. [[esql-query-api-request-body]]
  34. === {api-request-body-title}
  35. `columnar`::
  36. (Optional, Boolean) If `true`, returns results in a columnar format. Defaults to
  37. `false`. The API only supports this parameter for CBOR, JSON, SMILE, and YAML
  38. responses. See <<esql-rest-columnar>>.
  39. `params`::
  40. (Optional, array) Values for parameters in the `query`. For syntax, refer to
  41. <<esql-rest-params>>.
  42. `query`::
  43. (Required, object) {esql} query to run. For syntax, refer to <<esql-syntax>>.
  44. [[esql-search-api-time-zone]]
  45. `time_zone`::
  46. (Optional, string) ISO-8601 time zone ID for the search. Several {esql}
  47. date/time functions use this time zone. Defaults to `Z` (UTC).
  48. [discrete]
  49. [role="child_attributes"]
  50. [[esql-query-api-response-body]]
  51. === {api-response-body-title}
  52. `columns`::
  53. (array of objects)
  54. Column headings for the search results. Each object is a column.
  55. +
  56. .Properties of `columns` objects
  57. [%collapsible%open]
  58. ====
  59. `name`::
  60. (string) Name of the column.
  61. `type`::
  62. (string) Data type for the column.
  63. ====
  64. `rows`::
  65. (array of arrays)
  66. Values for the search results.