dissect.asciidoc 1.7 KB

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