Enum Class TextFormat

java.lang.Object
java.lang.Enum<TextFormat>
org.elasticsearch.xpack.esql.formatter.TextFormat
All Implemented Interfaces:
Serializable, Comparable<TextFormat>, Constable, org.elasticsearch.xcontent.MediaType

public enum TextFormat extends Enum<TextFormat> implements org.elasticsearch.xcontent.MediaType
Templating class for displaying ESQL responses in text formats.
  • Enum Constant Details

    • PLAIN_TEXT

      public static final TextFormat PLAIN_TEXT
      Default text writer.
    • CSV

      public static final TextFormat CSV
      Comma Separated Values implementation. Based on: https://tools.ietf.org/html/rfc4180 https://www.iana.org/assignments/media-types/text/csv https://www.w3.org/TR/sparql11-results-csv-tsv/
    • TSV

      public static final TextFormat TSV
  • Field Details

  • Method Details

    • values

      public static TextFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TextFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • format

      public Iterator<org.elasticsearch.core.CheckedConsumer<Writer,IOException>> format(RestRequest request, EsqlQueryResponse esqlResponse)
    • contentType

      public String contentType(RestRequest request)
      Content type depending on the request. Might be used by some formatters (like CSV) to specify certain metadata like whether the header is returned or not.
    • delimiter

      protected abstract Character delimiter()
      Delimiter between fields
    • delimiter

      protected Character delimiter(RestRequest request)
    • eol

      protected abstract String eol()
      String indicating end-of-line or row.