getbuckets

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: 12 Imported by: 0

Documentation

Overview

Retrieves anomaly detection job results for one or more buckets.

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 GetBuckets

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

func New

Retrieves anomaly detection job results for one or more buckets.

https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html

func (*GetBuckets) AnomalyScore

func (r *GetBuckets) AnomalyScore(v string) *GetBuckets

AnomalyScore Returns buckets with anomaly scores greater or equal than this value. API name: anomaly_score

func (*GetBuckets) Desc

func (r *GetBuckets) Desc(b bool) *GetBuckets

Desc If `true`, the buckets are sorted in descending order. API name: desc

func (GetBuckets) Do

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

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

func (*GetBuckets) End

func (r *GetBuckets) End(v string) *GetBuckets

End Returns buckets with timestamps earlier than this time. `-1` means it is unset and results are not limited to specific timestamps. API name: end

func (*GetBuckets) ExcludeInterim

func (r *GetBuckets) ExcludeInterim(b bool) *GetBuckets

ExcludeInterim If `true`, the output excludes interim results. API name: exclude_interim

func (*GetBuckets) Expand

func (r *GetBuckets) Expand(b bool) *GetBuckets

Expand If true, the output includes anomaly records. API name: expand

func (*GetBuckets) From

func (r *GetBuckets) From(i int) *GetBuckets

From Skips the specified number of buckets. API name: from

func (*GetBuckets) Header

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

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

func (*GetBuckets) HttpRequest

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

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

func (*GetBuckets) JobId

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

JobId Identifier for the anomaly detection job. API Name: jobid

func (GetBuckets) Perform

func (r GetBuckets) Perform(ctx context.Context) (*http.Response, error)

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

func (*GetBuckets) Raw

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

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

func (*GetBuckets) Request

func (r *GetBuckets) Request(req *Request) *GetBuckets

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

func (*GetBuckets) Size

func (r *GetBuckets) Size(i int) *GetBuckets

Size Specifies the maximum number of buckets to obtain. API name: size

func (*GetBuckets) Sort

func (r *GetBuckets) Sort(v string) *GetBuckets

Sort Specifies the sort field for the requested buckets. API name: sort

func (*GetBuckets) Start

func (r *GetBuckets) Start(v string) *GetBuckets

Start Returns buckets with timestamps after this time. `-1` means it is unset and results are not limited to specific timestamps. API name: start

func (*GetBuckets) Timestamp

func (r *GetBuckets) Timestamp(v string) *GetBuckets

Timestamp The timestamp of a single bucket result. If you do not specify this parameter, the API returns information about all buckets. API Name: timestamp

type NewGetBuckets

type NewGetBuckets func(jobid string) *GetBuckets

NewGetBuckets type alias for index.

func NewGetBucketsFunc

func NewGetBucketsFunc(tp elastictransport.Interface) NewGetBuckets

NewGetBucketsFunc returns a new instance of GetBuckets 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 {

	// AnomalyScore Refer to the description for the `anomaly_score` query parameter.
	AnomalyScore *types.Float64 `json:"anomaly_score,omitempty"`
	// Desc Refer to the description for the `desc` query parameter.
	Desc *bool `json:"desc,omitempty"`
	// End Refer to the description for the `end` query parameter.
	End types.DateTime `json:"end,omitempty"`
	// ExcludeInterim Refer to the description for the `exclude_interim` query parameter.
	ExcludeInterim *bool `json:"exclude_interim,omitempty"`
	// Expand Refer to the description for the `expand` query parameter.
	Expand *bool       `json:"expand,omitempty"`
	Page   *types.Page `json:"page,omitempty"`
	// Sort Refer to the desription for the `sort` query parameter.
	Sort *string `json:"sort,omitempty"`
	// Start Refer to the description for the `start` query parameter.
	Start types.DateTime `json:"start,omitempty"`
}

Request holds the request body struct for the package getbuckets

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/ml/get_buckets/MlGetBucketsRequest.ts#L26-L133

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 {
	Buckets []types.BucketSummary `json:"buckets"`
	Count   int64                 `json:"count"`
}

func NewResponse

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