keep.asciidoc 976 B

1234567891011121314151617181920212223242526272829303132333435
  1. [discrete]
  2. [[esql-keep]]
  3. === `KEEP`
  4. The `KEEP` command enables you to specify what columns are returned and the
  5. order in which they are returned.
  6. To limit the columns that are returned, use a comma-separated list of column
  7. names. The columns are returned in the specified order:
  8. [source.merge.styled,esql]
  9. ----
  10. include::{esql-specs}/docs.csv-spec[tag=keep]
  11. ----
  12. [%header.monospaced.styled,format=dsv,separator=|]
  13. |===
  14. include::{esql-specs}/docs.csv-spec[tag=keep-result]
  15. |===
  16. Rather than specify each column by name, you can use wildcards to return all
  17. columns with a name that matches a pattern:
  18. [source,esql]
  19. ----
  20. include::{esql-specs}/docs.csv-spec[tag=keepWildcard]
  21. ----
  22. The asterisk wildcard (`*`) by itself translates to all columns that do not
  23. match the other arguments. This query will first return all columns with a name
  24. that starts with an h, followed by all other columns:
  25. [source,esql]
  26. ----
  27. include::{esql-specs}/docs.csv-spec[tag=keepDoubleWildcard]
  28. ----