bulk

package
v8.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Used by the monitoring features to send monitoring data.

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 Bulk

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

func (*Bulk) CreateOp added in v8.10.0

func (r *Bulk) CreateOp(op types.CreateOperation, doc interface{}) error

CreateOp is a helper function to add a CreateOperation to the current bulk request. doc argument can be a []byte, json.RawMessage or a struct.

func (*Bulk) DeleteOp added in v8.10.0

func (r *Bulk) DeleteOp(op types.DeleteOperation) error

DeleteOp is a helper function to add a DeleteOperation to the current bulk request.

func (Bulk) Do

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

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

func (*Bulk) Header

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

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

func (*Bulk) HttpRequest

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

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

func (*Bulk) IndexOp added in v8.10.0

func (r *Bulk) IndexOp(op types.IndexOperation, doc interface{}) error

IndexOp is a helper function to add an IndexOperation to the current bulk request. doc argument can be a []byte, json.RawMessage or a struct.

func (*Bulk) Interval

func (r *Bulk) Interval(duration string) *Bulk

Interval Collection interval (e.g., '10s' or '10000ms') of the payload API name: interval

func (Bulk) Perform

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

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

func (*Bulk) Raw

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

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

func (*Bulk) Request

func (r *Bulk) Request(req *Request) *Bulk

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

func (*Bulk) SystemApiVersion

func (r *Bulk) SystemApiVersion(systemapiversion string) *Bulk

API name: system_api_version

func (*Bulk) SystemId

func (r *Bulk) SystemId(systemid string) *Bulk

SystemId Identifier of the monitored system API name: system_id

func (*Bulk) Type

func (r *Bulk) Type(type_ string) *Bulk

Type Default document type for items which don't provide one API Name: type_

func (*Bulk) UpdateOp added in v8.10.0

func (r *Bulk) UpdateOp(op types.UpdateOperation, doc interface{}, update *types.UpdateAction) error

UpdateOp is a helper function to add an UpdateOperation with and UpdateAction to the current bulk request. update is optional, if both doc and update.Doc are provided, update.Doc has precedence.

type NewBulk

type NewBulk func() *Bulk

NewBulk type alias for index.

func NewBulkFunc

func NewBulkFunc(tp elastictransport.Interface) NewBulk

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

type Response

type Response struct {
	Error *types.ErrorCause `json:"error,omitempty"`
	// Errors True if there is was an error
	Errors bool `json:"errors"`
	// Ignored Was collection disabled?
	Ignored bool  `json:"ignored"`
	Took    int64 `json:"took"`
}

Response holds the response body struct for the package bulk

https://github.com/elastic/elasticsearch-specification/blob/b2c13a00c152a97cb41193deda8ed9b37fd06796/specification/monitoring/bulk/BulkMonitoringResponse.ts#L23-L32

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