dissect.asciidoc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [discrete]
  2. [[esql-dissect]]
  3. === `DISSECT`
  4. **Syntax**
  5. [source,esql]
  6. ----
  7. DISSECT input "pattern" [APPEND_SEPARATOR="<separator>"]
  8. ----
  9. *Parameters*
  10. `input`::
  11. The column that contains the string you want to structure. If the column has
  12. multiple values, `DISSECT` will process each value.
  13. `pattern`::
  14. A <<esql-dissect-patterns,dissect pattern>>.
  15. `<separator>`::
  16. A string used as the separator between appended values, when using the <<esql-append-modifier,append modifier>>.
  17. *Description*
  18. `DISSECT` enables you to <<esql-process-data-with-dissect-and-grok,extract
  19. structured data out of a string>>. `DISSECT` matches the string against a
  20. delimiter-based pattern, and extracts the specified keys as columns.
  21. Refer to <<esql-process-data-with-dissect>> for the syntax of dissect patterns.
  22. *Examples*
  23. // tag::examples[]
  24. The following example parses a string that contains a timestamp, some text, and
  25. an IP address:
  26. [source.merge.styled,esql]
  27. ----
  28. include::{esql-specs}/docs.csv-spec[tag=basicDissect]
  29. ----
  30. [%header.monospaced.styled,format=dsv,separator=|]
  31. |===
  32. include::{esql-specs}/docs.csv-spec[tag=basicDissect-result]
  33. |===
  34. By default, `DISSECT` outputs keyword string columns. To convert to another
  35. type, use <<esql-type-conversion-functions>>:
  36. [source.merge.styled,esql]
  37. ----
  38. include::{esql-specs}/docs.csv-spec[tag=dissectWithToDatetime]
  39. ----
  40. [%header.monospaced.styled,format=dsv,separator=|]
  41. |===
  42. include::{esql-specs}/docs.csv-spec[tag=dissectWithToDatetime-result]
  43. |===
  44. // end::examples[]