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

public class DataDescription extends Object implements 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

  • Constructor Details

  • Method Details

    • writeTo

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

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface 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