putjob

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

Creates a rollup 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 NewPutJob

type NewPutJob func(id string) *PutJob

NewPutJob type alias for index.

func NewPutJobFunc

func NewPutJobFunc(tp elastictransport.Interface) NewPutJob

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

type PutJob

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

func (*PutJob) Cron added in v8.9.0

func (r *PutJob) Cron(cron string) *PutJob

Cron A cron string which defines the intervals when the rollup job should be executed. When the interval triggers, the indexer attempts to rollup the data in the index pattern. The cron pattern is unrelated to the time interval of the data being rolled up. For example, you may wish to create hourly rollups of your document but to only run the indexer on a daily basis at midnight, as defined by the cron. The cron pattern is defined just like a Watcher cron schedule. API name: cron

func (PutJob) Do

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

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

func (*PutJob) Groups added in v8.9.0

func (r *PutJob) Groups(groups *types.Groupings) *PutJob

Groups Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of the groups configuration as defining a set of tools that can later be used in aggregations to partition the data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide enough flexibility that you simply need to determine which fields are needed, not in what order they are needed. API name: groups

func (*PutJob) Header

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

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

func (*PutJob) Headers added in v8.9.0

func (r *PutJob) Headers(httpheaders types.HttpHeaders) *PutJob

API name: headers

func (*PutJob) HttpRequest

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

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

func (*PutJob) IndexPattern added in v8.9.0

func (r *PutJob) IndexPattern(indexpattern string) *PutJob

IndexPattern The index or index pattern to roll up. Supports wildcard-style patterns (`logstash-*`). The job attempts to rollup the entire index or index-pattern. API name: index_pattern

func (*PutJob) Metrics added in v8.9.0

func (r *PutJob) Metrics(metrics ...types.FieldMetric) *PutJob

Metrics Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined on a per-field basis and for each field you configure which metric should be collected. API name: metrics

func (*PutJob) PageSize added in v8.9.0

func (r *PutJob) PageSize(pagesize int) *PutJob

PageSize The number of bucket results that are processed on each iteration of the rollup indexer. A larger value tends to execute faster, but requires more memory during processing. This value has no effect on how the data is rolled up; it is merely used for tweaking the speed or memory cost of the indexer. API name: page_size

func (PutJob) Perform added in v8.7.0

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

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

func (*PutJob) Raw

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

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

func (*PutJob) Request

func (r *PutJob) Request(req *Request) *PutJob

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

func (*PutJob) RollupIndex added in v8.9.0

func (r *PutJob) RollupIndex(indexname string) *PutJob

RollupIndex The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs. API name: rollup_index

func (*PutJob) Timeout added in v8.9.0

func (r *PutJob) Timeout(duration types.Duration) *PutJob

Timeout Time to wait for the request to complete. API name: timeout

type Request

type Request struct {

	// Cron A cron string which defines the intervals when the rollup job should be
	// executed. When the interval
	// triggers, the indexer attempts to rollup the data in the index pattern. The
	// cron pattern is unrelated
	// to the time interval of the data being rolled up. For example, you may wish
	// to create hourly rollups
	// of your document but to only run the indexer on a daily basis at midnight, as
	// defined by the cron. The
	// cron pattern is defined just like a Watcher cron schedule.
	Cron string `json:"cron"`
	// Groups Defines the grouping fields and aggregations that are defined for this rollup
	// job. These fields will then be
	// available later for aggregating into buckets. These aggs and fields can be
	// used in any combination. Think of
	// the groups configuration as defining a set of tools that can later be used in
	// aggregations to partition the
	// data. Unlike raw data, we have to think ahead to which fields and
	// aggregations might be used. Rollups provide
	// enough flexibility that you simply need to determine which fields are needed,
	// not in what order they are needed.
	Groups  types.Groupings   `json:"groups"`
	Headers types.HttpHeaders `json:"headers,omitempty"`
	// IndexPattern The index or index pattern to roll up. Supports wildcard-style patterns
	// (`logstash-*`). The job attempts to
	// rollup the entire index or index-pattern.
	IndexPattern string `json:"index_pattern"`
	// Metrics Defines the metrics to collect for each grouping tuple. By default, only the
	// doc_counts are collected for each
	// group. To make rollup useful, you will often add metrics like averages, mins,
	// maxes, etc. Metrics are defined
	// on a per-field basis and for each field you configure which metric should be
	// collected.
	Metrics []types.FieldMetric `json:"metrics,omitempty"`
	// PageSize The number of bucket results that are processed on each iteration of the
	// rollup indexer. A larger value tends
	// to execute faster, but requires more memory during processing. This value has
	// no effect on how the data is
	// rolled up; it is merely used for tweaking the speed or memory cost of the
	// indexer.
	PageSize int `json:"page_size"`
	// RollupIndex The index that contains the rollup results. The index can be shared with
	// other rollup jobs. The data is stored so that it doesn’t interfere with
	// unrelated jobs.
	RollupIndex string `json:"rollup_index"`
	// Timeout Time to wait for the request to complete.
	Timeout types.Duration `json:"timeout,omitempty"`
}

Request holds the request body struct for the package putjob

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/rollup/put_job/CreateRollupJobRequest.ts#L27-L89

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 {

	// Acknowledged For a successful response, this value is always true. On failure, an
	// exception is returned instead.
	Acknowledged bool `json:"acknowledged"`
}

Response holds the response body struct for the package putjob

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/rollup/put_job/CreateRollupJobResponse.ts#L22-L24

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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