to_ip.asciidoc 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. [discrete]
  2. [[esql-to_ip]]
  3. === `TO_IP`
  4. *Syntax*
  5. [source,esql]
  6. ----
  7. TO_IP(v)
  8. ----
  9. *Parameters*
  10. `v`::
  11. Input value. The input can be a single- or multi-valued column or an expression.
  12. *Description*
  13. Converts an input string to an IP value.
  14. *Example*
  15. [source.merge.styled,esql]
  16. ----
  17. include::{esql-specs}/ip.csv-spec[tag=to_ip]
  18. ----
  19. [%header.monospaced.styled,format=dsv,separator=|]
  20. |===
  21. include::{esql-specs}/ip.csv-spec[tag=to_ip-result]
  22. |===
  23. Note that in this example, the last conversion of the string isn't possible.
  24. When this happens, the result is a *null* value. In this case a _Warning_ header
  25. is added to the response. The header will provide information on the source of
  26. the failure:
  27. `"Line 1:68: evaluation of [TO_IP(str2)] failed, treating result as null. Only first 20 failures recorded."`
  28. A following header will contain the failure reason and the offending value:
  29. `"java.lang.IllegalArgumentException: 'foo' is not an IP string literal."`