keep.asciidoc 965 B

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