java.lang.Object
org.elasticsearch.xpack.core.ml.job.config.Job
All Implemented Interfaces:
Diffable<Job>, SimpleDiffable<Job>, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class Job extends Object implements SimpleDiffable<Job>, Writeable, org.elasticsearch.xcontent.ToXContentObject
This class represents a configured and created Job. The creation time is set to the time the object was constructed and the finished time and last data time fields are null until the job has seen some data or it is finished respectively.
  • Field Details

    • TYPE

      public static final String TYPE
      See Also:
    • ANOMALY_DETECTOR_JOB_TYPE

      public static final String ANOMALY_DETECTOR_JOB_TYPE
      See Also:
    • ID

      public static final org.elasticsearch.xcontent.ParseField ID
    • JOB_TYPE

      public static final org.elasticsearch.xcontent.ParseField JOB_TYPE
    • JOB_VERSION

      public static final org.elasticsearch.xcontent.ParseField JOB_VERSION
    • GROUPS

      public static final org.elasticsearch.xcontent.ParseField GROUPS
    • ANALYSIS_CONFIG

      public static final org.elasticsearch.xcontent.ParseField ANALYSIS_CONFIG
    • ANALYSIS_LIMITS

      public static final org.elasticsearch.xcontent.ParseField ANALYSIS_LIMITS
    • CREATE_TIME

      public static final org.elasticsearch.xcontent.ParseField CREATE_TIME
    • CUSTOM_SETTINGS

      public static final org.elasticsearch.xcontent.ParseField CUSTOM_SETTINGS
    • DATA_DESCRIPTION

      public static final org.elasticsearch.xcontent.ParseField DATA_DESCRIPTION
    • DESCRIPTION

      public static final org.elasticsearch.xcontent.ParseField DESCRIPTION
    • FINISHED_TIME

      public static final org.elasticsearch.xcontent.ParseField FINISHED_TIME
    • MODEL_PLOT_CONFIG

      public static final org.elasticsearch.xcontent.ParseField MODEL_PLOT_CONFIG
    • RENORMALIZATION_WINDOW_DAYS

      public static final org.elasticsearch.xcontent.ParseField RENORMALIZATION_WINDOW_DAYS
    • BACKGROUND_PERSIST_INTERVAL

      public static final org.elasticsearch.xcontent.ParseField BACKGROUND_PERSIST_INTERVAL
    • MODEL_SNAPSHOT_RETENTION_DAYS

      public static final org.elasticsearch.xcontent.ParseField MODEL_SNAPSHOT_RETENTION_DAYS
    • DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS

      public static final org.elasticsearch.xcontent.ParseField DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS
    • RESULTS_RETENTION_DAYS

      public static final org.elasticsearch.xcontent.ParseField RESULTS_RETENTION_DAYS
    • MODEL_SNAPSHOT_ID

      public static final org.elasticsearch.xcontent.ParseField MODEL_SNAPSHOT_ID
    • MODEL_SNAPSHOT_MIN_VERSION

      public static final org.elasticsearch.xcontent.ParseField MODEL_SNAPSHOT_MIN_VERSION
    • RESULTS_INDEX_NAME

      public static final org.elasticsearch.xcontent.ParseField RESULTS_INDEX_NAME
    • DELETING

      public static final org.elasticsearch.xcontent.ParseField DELETING
    • ALLOW_LAZY_OPEN

      public static final org.elasticsearch.xcontent.ParseField ALLOW_LAZY_OPEN
    • BLOCKED

      public static final org.elasticsearch.xcontent.ParseField BLOCKED
    • DATAFEED_CONFIG

      public static final org.elasticsearch.xcontent.ParseField DATAFEED_CONFIG
    • RESULTS_FIELD

      public static final org.elasticsearch.xcontent.ParseField RESULTS_FIELD
    • LENIENT_PARSER

      public static final org.elasticsearch.xcontent.ObjectParser<Job.Builder,Void> LENIENT_PARSER
    • REST_REQUEST_PARSER

      public static final org.elasticsearch.xcontent.ObjectParser<Job.Builder,Void> REST_REQUEST_PARSER
    • MIN_BACKGROUND_PERSIST_INTERVAL

      public static final org.elasticsearch.core.TimeValue MIN_BACKGROUND_PERSIST_INTERVAL
    • PROCESS_MEMORY_OVERHEAD

      public static final ByteSizeValue PROCESS_MEMORY_OVERHEAD
      This includes the overhead of thread stacks and data structures that the program might use that are not instrumented. (For the autodetect process categorization is not instrumented, and the normalize process is not instrumented at all.) But this overhead does NOT include the memory used by loading the executable code.
    • DEFAULT_MODEL_SNAPSHOT_RETENTION_DAYS

      public static final long DEFAULT_MODEL_SNAPSHOT_RETENTION_DAYS
      See Also:
    • DEFAULT_DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS

      public static final long DEFAULT_DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS
      See Also:
  • Constructor Details

  • Method Details

    • documentId

      public static String documentId(String jobId)
      Get the persisted job document name from the Job Id. Throws if jobId is not a valid job Id.
      Parameters:
      jobId - The job id
      Returns:
      The id of document the job is persisted in
    • extractJobIdFromDocumentId

      @Nullable public static String extractJobIdFromDocumentId(String docId)
      Returns the job id from the doc id. Returns null if the doc id is invalid.
    • getId

      public String getId()
      Return the Job Id.
      Returns:
      The job Id string
    • getJobType

      public String getJobType()
    • getJobVersion

      public MlConfigVersion getJobVersion()
    • getGroups

      public List<String> getGroups()
    • getInitialResultsIndexName

      public String getInitialResultsIndexName()
      A good starting name for the index storing the job's results. This defaults to the shared results index if a specific index name is not set. This method must only be used during initial job creation. After that the read/write aliases must always be used to access the job's results index, as the underlying index may roll or be reindexed.
      Returns:
      The job's initial results index name
    • getDescription

      public String getDescription()
      The job description
      Returns:
      job description
    • getCreateTime

      public Date getCreateTime()
      The Job creation time. This name is preferred when serialising to the REST API.
      Returns:
      The date the job was created
    • getFinishedTime

      public Date getFinishedTime()
      The time the job was finished or null if not finished.
      Returns:
      The date the job was last retired or null
    • getAnalysisConfig

      public AnalysisConfig getAnalysisConfig()
      The analysis configuration object
      Returns:
      The AnalysisConfig
    • getAnalysisLimits

      public AnalysisLimits getAnalysisLimits()
      The analysis options object
      Returns:
      The AnalysisLimits
    • getModelPlotConfig

      public ModelPlotConfig getModelPlotConfig()
    • getDataDescription

      public DataDescription getDataDescription()
      If not set the input data is assumed to be csv with a '_time' field in epoch format.
      Returns:
      A DataDescription or null
      See Also:
    • getRenormalizationWindowDays

      public Long getRenormalizationWindowDays()
      The duration of the renormalization window in days
      Returns:
      renormalization window in days
    • getBackgroundPersistInterval

      public org.elasticsearch.core.TimeValue getBackgroundPersistInterval()
      The background persistence interval
      Returns:
      background persistence interval
    • getModelSnapshotRetentionDays

      public Long getModelSnapshotRetentionDays()
    • getDailyModelSnapshotRetentionAfterDays

      public Long getDailyModelSnapshotRetentionAfterDays()
    • getResultsRetentionDays

      public Long getResultsRetentionDays()
    • getCustomSettings

      public Map<String,Object> getCustomSettings()
    • getModelSnapshotId

      public String getModelSnapshotId()
    • getModelSnapshotMinVersion

      public MlConfigVersion getModelSnapshotMinVersion()
    • isDeleting

      public boolean isDeleting()
    • isResetting

      public boolean isResetting()
    • allowLazyOpen

      public boolean allowLazyOpen()
    • getBlocked

      public Blocked getBlocked()
    • allInputFields

      public Collection<String> allInputFields()
      Get all input data fields mentioned in the job configuration, namely analysis fields and the time field.
      Returns:
      the collection of fields - never null
    • earliestValidTimestamp

      public long earliestValidTimestamp(DataCounts dataCounts)
      Returns the timestamp before which data is not accepted by the job. This is the latest record timestamp minus the job latency.
      Parameters:
      dataCounts - the job data counts
      Returns:
      the timestamp before which data is not accepted by the job
    • getDatafeedConfig

      public Optional<DatafeedConfig> getDatafeedConfig()
    • 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
    • doXContentBody

      public org.elasticsearch.xcontent.XContentBuilder doXContentBody(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getCompatibleJobTypes

      public static Set<String> getCompatibleJobTypes(MlConfigVersion mlConfigVersion)
      Returns the job types that are compatible with a node with mlConfigVersion
      Parameters:
      mlConfigVersion - the version ML configuration in use
      Returns:
      the compatible job types