updatejob

package
v8.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Overview

Updates certain properties of an anomaly detection job.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type NewUpdateJob

type NewUpdateJob func(jobid string) *UpdateJob

NewUpdateJob type alias for index.

func NewUpdateJobFunc

func NewUpdateJobFunc(tp elastictransport.Interface) NewUpdateJob

NewUpdateJobFunc returns a new instance of UpdateJob with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request struct {

	// AllowLazyOpen Advanced configuration option. Specifies whether this job can open when
	// there is insufficient machine learning node capacity for it to be
	// immediately assigned to a node. If `false` and a machine learning node
	// with capacity to run the job cannot immediately be found, the open
	// anomaly detection jobs API returns an error. However, this is also
	// subject to the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. If this
	// option is set to `true`, the open anomaly detection jobs API does not
	// return an error and the job waits in the opening state until sufficient
	// machine learning node capacity is available.
	AllowLazyOpen  *bool                      `json:"allow_lazy_open,omitempty"`
	AnalysisLimits *types.AnalysisMemoryLimit `json:"analysis_limits,omitempty"`
	// BackgroundPersistInterval Advanced configuration option. The time between each periodic persistence
	// of the model.
	// The default value is a randomized value between 3 to 4 hours, which
	// avoids all jobs persisting at exactly the same time. The smallest allowed
	// value is 1 hour.
	// For very large models (several GB), persistence could take 10-20 minutes,
	// so do not set the value too low.
	// If the job is open when you make the update, you must stop the datafeed,
	// close the job, then reopen the job and restart the datafeed for the
	// changes to take effect.
	BackgroundPersistInterval types.Duration `json:"background_persist_interval,omitempty"`
	CategorizationFilters     []string       `json:"categorization_filters,omitempty"`
	// CustomSettings Advanced configuration option. Contains custom meta data about the job.
	// For example, it can contain custom URL information as shown in Adding
	// custom URLs to machine learning results.
	CustomSettings map[string]json.RawMessage `json:"custom_settings,omitempty"`
	// DailyModelSnapshotRetentionAfterDays Advanced configuration option, which affects the automatic removal of old
	// model snapshots for this job. It specifies a period of time (in days)
	// after which only the first snapshot per day is retained. This period is
	// relative to the timestamp of the most recent snapshot for this job. Valid
	// values range from 0 to `model_snapshot_retention_days`. For jobs created
	// before version 7.8.0, the default value matches
	// `model_snapshot_retention_days`.
	DailyModelSnapshotRetentionAfterDays *int64 `json:"daily_model_snapshot_retention_after_days,omitempty"`
	// Description A description of the job.
	Description *string `json:"description,omitempty"`
	// Detectors An array of detector update objects.
	Detectors []types.Detector `json:"detectors,omitempty"`
	// Groups A list of job groups. A job can belong to no groups or many.
	Groups           []string               `json:"groups,omitempty"`
	ModelPlotConfig  *types.ModelPlotConfig `json:"model_plot_config,omitempty"`
	ModelPruneWindow types.Duration         `json:"model_prune_window,omitempty"`
	// ModelSnapshotRetentionDays Advanced configuration option, which affects the automatic removal of old
	// model snapshots for this job. It specifies the maximum period of time (in
	// days) that snapshots are retained. This period is relative to the
	// timestamp of the most recent snapshot for this job.
	ModelSnapshotRetentionDays *int64 `json:"model_snapshot_retention_days,omitempty"`
	// PerPartitionCategorization Settings related to how categorization interacts with partition fields.
	PerPartitionCategorization *types.PerPartitionCategorization `json:"per_partition_categorization,omitempty"`
	// RenormalizationWindowDays Advanced configuration option. The period over which adjustments to the
	// score are applied, as new data is seen.
	RenormalizationWindowDays *int64 `json:"renormalization_window_days,omitempty"`
	// ResultsRetentionDays Advanced configuration option. The period of time (in days) that results
	// are retained. Age is calculated relative to the timestamp of the latest
	// bucket result. If this property has a non-null value, once per day at
	// 00:30 (server time), results that are the specified number of days older
	// than the latest bucket result are deleted from Elasticsearch. The default
	// value is null, which means all results are retained.
	ResultsRetentionDays *int64 `json:"results_retention_days,omitempty"`
}

Request holds the request body struct for the package updatejob

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/ml/update_job/MlUpdateJobRequest.ts#L33-L138

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request) UnmarshalJSON added in v8.12.1

func (s *Request) UnmarshalJSON(data []byte) error

type Response added in v8.7.0

type Response struct {
	AllowLazyOpen                        bool                     `json:"allow_lazy_open"`
	AnalysisConfig                       types.AnalysisConfigRead `json:"analysis_config"`
	AnalysisLimits                       types.AnalysisLimits     `json:"analysis_limits"`
	BackgroundPersistInterval            types.Duration           `json:"background_persist_interval,omitempty"`
	CreateTime                           int64                    `json:"create_time"`
	CustomSettings                       map[string]string        `json:"custom_settings,omitempty"`
	DailyModelSnapshotRetentionAfterDays int64                    `json:"daily_model_snapshot_retention_after_days"`
	DataDescription                      types.DataDescription    `json:"data_description"`
	DatafeedConfig                       *types.MLDatafeed        `json:"datafeed_config,omitempty"`
	Description                          *string                  `json:"description,omitempty"`
	FinishedTime                         *int64                   `json:"finished_time,omitempty"`
	Groups                               []string                 `json:"groups,omitempty"`
	JobId                                string                   `json:"job_id"`
	JobType                              string                   `json:"job_type"`
	JobVersion                           string                   `json:"job_version"`
	ModelPlotConfig                      *types.ModelPlotConfig   `json:"model_plot_config,omitempty"`
	ModelSnapshotId                      *string                  `json:"model_snapshot_id,omitempty"`
	ModelSnapshotRetentionDays           int64                    `json:"model_snapshot_retention_days"`
	RenormalizationWindowDays            *int64                   `json:"renormalization_window_days,omitempty"`
	ResultsIndexName                     string                   `json:"results_index_name"`
	ResultsRetentionDays                 *int64                   `json:"results_retention_days,omitempty"`
}

Response holds the response body struct for the package updatejob

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/ml/update_job/MlUpdateJobResponse.ts#L29-L53

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

type UpdateJob

type UpdateJob struct {
	// contains filtered or unexported fields
}

func New

Updates certain properties of an anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html

func (*UpdateJob) AllowLazyOpen added in v8.9.0

func (r *UpdateJob) AllowLazyOpen(allowlazyopen bool) *UpdateJob

AllowLazyOpen Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. If `false` and a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. If this option is set to `true`, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. API name: allow_lazy_open

func (*UpdateJob) AnalysisLimits added in v8.9.0

func (r *UpdateJob) AnalysisLimits(analysislimits *types.AnalysisMemoryLimit) *UpdateJob

API name: analysis_limits

func (*UpdateJob) BackgroundPersistInterval added in v8.9.0

func (r *UpdateJob) BackgroundPersistInterval(duration types.Duration) *UpdateJob

BackgroundPersistInterval Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the value too low. If the job is open when you make the update, you must stop the datafeed, close the job, then reopen the job and restart the datafeed for the changes to take effect. API name: background_persist_interval

func (*UpdateJob) CategorizationFilters added in v8.9.0

func (r *UpdateJob) CategorizationFilters(categorizationfilters ...string) *UpdateJob

API name: categorization_filters

func (*UpdateJob) CustomSettings added in v8.9.0

func (r *UpdateJob) CustomSettings(customsettings map[string]json.RawMessage) *UpdateJob

CustomSettings Advanced configuration option. Contains custom meta data about the job. For example, it can contain custom URL information as shown in Adding custom URLs to machine learning results. API name: custom_settings

func (*UpdateJob) DailyModelSnapshotRetentionAfterDays added in v8.9.0

func (r *UpdateJob) DailyModelSnapshotRetentionAfterDays(dailymodelsnapshotretentionafterdays int64) *UpdateJob

DailyModelSnapshotRetentionAfterDays Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to `model_snapshot_retention_days`. For jobs created before version 7.8.0, the default value matches `model_snapshot_retention_days`. API name: daily_model_snapshot_retention_after_days

func (*UpdateJob) Description added in v8.9.0

func (r *UpdateJob) Description(description string) *UpdateJob

Description A description of the job. API name: description

func (*UpdateJob) Detectors added in v8.9.0

func (r *UpdateJob) Detectors(detectors ...types.Detector) *UpdateJob

Detectors An array of detector update objects. API name: detectors

func (UpdateJob) Do

func (r UpdateJob) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a updatejob.Response

func (*UpdateJob) Groups added in v8.9.0

func (r *UpdateJob) Groups(groups ...string) *UpdateJob

Groups A list of job groups. A job can belong to no groups or many. API name: groups

func (*UpdateJob) Header

func (r *UpdateJob) Header(key, value string) *UpdateJob

Header set a key, value pair in the UpdateJob headers map.

func (*UpdateJob) HttpRequest

func (r *UpdateJob) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*UpdateJob) ModelPlotConfig added in v8.9.0

func (r *UpdateJob) ModelPlotConfig(modelplotconfig *types.ModelPlotConfig) *UpdateJob

API name: model_plot_config

func (*UpdateJob) ModelPruneWindow added in v8.9.0

func (r *UpdateJob) ModelPruneWindow(duration types.Duration) *UpdateJob

API name: model_prune_window

func (*UpdateJob) ModelSnapshotRetentionDays added in v8.9.0

func (r *UpdateJob) ModelSnapshotRetentionDays(modelsnapshotretentiondays int64) *UpdateJob

ModelSnapshotRetentionDays Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. API name: model_snapshot_retention_days

func (*UpdateJob) PerPartitionCategorization added in v8.9.0

func (r *UpdateJob) PerPartitionCategorization(perpartitioncategorization *types.PerPartitionCategorization) *UpdateJob

PerPartitionCategorization Settings related to how categorization interacts with partition fields. API name: per_partition_categorization

func (UpdateJob) Perform added in v8.7.0

func (r UpdateJob) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*UpdateJob) Raw

func (r *UpdateJob) Raw(raw io.Reader) *UpdateJob

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*UpdateJob) RenormalizationWindowDays added in v8.9.0

func (r *UpdateJob) RenormalizationWindowDays(renormalizationwindowdays int64) *UpdateJob

RenormalizationWindowDays Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. API name: renormalization_window_days

func (*UpdateJob) Request

func (r *UpdateJob) Request(req *Request) *UpdateJob

Request allows to set the request property with the appropriate payload.

func (*UpdateJob) ResultsRetentionDays added in v8.9.0

func (r *UpdateJob) ResultsRetentionDays(resultsretentiondays int64) *UpdateJob

ResultsRetentionDays Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. API name: results_retention_days

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL