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

public class Detector extends Object implements org.elasticsearch.xcontent.ToXContentObject, Writeable
Defines the fields to be used in the analysis. fieldname must be set and only one of byFieldName and overFieldName should be set.
  • Field Details

    • DETECTOR_DESCRIPTION_FIELD

      public static final org.elasticsearch.xcontent.ParseField DETECTOR_DESCRIPTION_FIELD
    • FUNCTION_FIELD

      public static final org.elasticsearch.xcontent.ParseField FUNCTION_FIELD
    • FIELD_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField FIELD_NAME_FIELD
    • BY_FIELD_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField BY_FIELD_NAME_FIELD
    • OVER_FIELD_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField OVER_FIELD_NAME_FIELD
    • PARTITION_FIELD_NAME_FIELD

      public static final org.elasticsearch.xcontent.ParseField PARTITION_FIELD_NAME_FIELD
    • USE_NULL_FIELD

      public static final org.elasticsearch.xcontent.ParseField USE_NULL_FIELD
    • EXCLUDE_FREQUENT_FIELD

      public static final org.elasticsearch.xcontent.ParseField EXCLUDE_FREQUENT_FIELD
    • CUSTOM_RULES_FIELD

      public static final org.elasticsearch.xcontent.ParseField CUSTOM_RULES_FIELD
    • DETECTOR_INDEX

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

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

      public static final org.elasticsearch.xcontent.ObjectParser<Detector.Builder,Void> STRICT_PARSER
    • BY

      public static final String BY
      See Also:
    • OVER

      public static final String OVER
      See Also:
    • COUNT_WITHOUT_FIELD_FUNCTIONS

      public static final EnumSet<DetectorFunction> COUNT_WITHOUT_FIELD_FUNCTIONS
      The set of functions that do not require a field, by field or over field
    • FIELD_NAME_FUNCTIONS

      public static final EnumSet<DetectorFunction> FIELD_NAME_FUNCTIONS
      The set of functions that require a fieldname
    • BY_FIELD_NAME_FUNCTIONS

      public static final EnumSet<DetectorFunction> BY_FIELD_NAME_FUNCTIONS
      The set of functions that require a by fieldname
    • OVER_FIELD_NAME_FUNCTIONS

      public static final EnumSet<DetectorFunction> OVER_FIELD_NAME_FUNCTIONS
      The set of functions that require a over fieldname
    • NO_OVER_FIELD_NAME_FUNCTIONS

      public static final EnumSet<DetectorFunction> NO_OVER_FIELD_NAME_FUNCTIONS
      The set of functions that cannot have an over fieldname
    • PROHIBITED_FIELDNAME_CHARACTERS

      public static final Character[] PROHIBITED_FIELDNAME_CHARACTERS
      field names cannot contain any of these characters ", \
    • PROHIBITED

      public static final String PROHIBITED
  • 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
    • getDetectorDescription

      public String getDetectorDescription()
    • getFunction

      public DetectorFunction getFunction()
      The analysis function used e.g. count, rare, min etc.
      Returns:
      The function or null if not set
    • getFieldName

      public String getFieldName()
      The Analysis field
      Returns:
      The field to analyse
    • getByFieldName

      public String getByFieldName()
      The 'by' field or null if not set.
      Returns:
      The 'by' field
    • getOverFieldName

      public String getOverFieldName()
      The 'over' field or null if not set.
      Returns:
      The 'over' field
    • getPartitionFieldName

      public String getPartitionFieldName()
      Segments the analysis along another field to have completely independent baselines for each instance of partitionfield
      Returns:
      The Partition Field
    • isUseNull

      public boolean isUseNull()
      Where there isn't a value for the 'by' or 'over' field should a new series be used as the 'null' series.
      Returns:
      true if the 'null' series should be created
    • getExcludeFrequent

      public Detector.ExcludeFrequent getExcludeFrequent()
      Excludes frequently-occurring metrics from the analysis; can apply to 'by' field, 'over' field, or both
      Returns:
      the value that the user set
    • getRules

      public List<DetectionRule> getRules()
    • getDetectorIndex

      public int getDetectorIndex()
      Returns:
      the detector index or a negative number if unknown
    • extractAnalysisFields

      public List<String> extractAnalysisFields()
      Returns a list with the byFieldName, overFieldName and partitionFieldName that are not null
      Returns:
      a list with the byFieldName, overFieldName and partitionFieldName that are not null
    • extractReferencedFilters

      public Set<String> extractReferencedFilters()
    • getByOverPartitionTerms

      public Set<String> getByOverPartitionTerms()
      Returns the set of by/over/partition terms
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object