java.lang.Object
org.elasticsearch.xpack.core.ml.job.config.DataDescription
All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class DataDescription extends Object implements org.elasticsearch.xcontent.ToXContentObject, Writeable
Describes the format of the data used in the job and how it should be interpreted by autodetect.

Data must either be in JSON or SMILE format (and only JSON is publicly documented). The DataDescription.DataFormat enum is always set to XCONTENT. getTimeField() is the name of the field containing the timestamp and getTimeFormat() is the format code for the date string in as described by DateTimeFormatter.

  • Field Details

    • DATA_DESCRIPTION_FIELD

      public static final org.elasticsearch.xcontent.ParseField DATA_DESCRIPTION_FIELD
    • FORMAT_FIELD

      public static final org.elasticsearch.xcontent.ParseField FORMAT_FIELD
    • TIME_FIELD_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField TIME_FIELD_NAME_FIELD
    • TIME_FORMAT_FIELD

      public static final org.elasticsearch.xcontent.ParseField TIME_FORMAT_FIELD
    • EPOCH

      public static final String EPOCH
      Special time format string for epoch times (seconds)
      See Also:
    • EPOCH_MS

      public static final String EPOCH_MS
      Special time format string for epoch times (milli-seconds)
      See Also:
    • DEFAULT_TIME_FIELD

      public static final String DEFAULT_TIME_FIELD
      By default autodetect expects the timestamp in a field with this name
      See Also:
    • LENIENT_PARSER

      public static final org.elasticsearch.xcontent.ObjectParser<DataDescription.Builder,Void> LENIENT_PARSER
    • STRICT_PARSER

      public static final org.elasticsearch.xcontent.ObjectParser<DataDescription.Builder,Void> STRICT_PARSER
  • Constructor Details

  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • getTimeField

      public String getTimeField()
      The name of the field containing the timestamp
      Returns:
      A String if set or null
    • getTimeFormat

      public String getTimeFormat()
      Either "epoch", "epoch_ms" or a SimpleDateTime format string. If not set (is null or an empty string) or set to "epoch_ms" (the default) then the date is assumed to be in milliseconds from the epoch.
      Returns:
      A String if set or null
    • isTransformTime

      public boolean isTransformTime()
      Return true if the time is in a format that needs transforming. Anytime format this isn't "epoch" or null needs transforming.
      Returns:
      True if the time field needs to be transformed.
    • isEpochMs

      public boolean isEpochMs()
      Return true if the time format is "epoch_ms"
      Returns:
      True if the date is in milli-seconds since the epoch.
    • equals

      public boolean equals(Object other)
      Overridden equality test
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object