updatejob

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/ml/update_job/MlUpdateJobRequest.ts#L33-L138

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

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

FromJSON allows to load an arbitrary json into the request structure

type Response

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"`
}

func NewResponse

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) Do

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

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

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) JobId

func (r *UpdateJob) JobId(v string) *UpdateJob

JobId Identifier for the job. API Name: jobid

func (UpdateJob) Perform

func (r UpdateJob) Perform(ctx 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) Request

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

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

Jump to

Keyboard shortcuts

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