rollover

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Updates an alias to point to a new index when the existing index is considered to be too large or too old.

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 NewRollover

type NewRollover func(alias string) *Rollover

NewRollover type alias for index.

func NewRolloverFunc

func NewRolloverFunc(tp elastictransport.Interface) NewRollover

NewRolloverFunc returns a new instance of Rollover 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 {
	Aliases    map[string]types.Alias     `json:"aliases,omitempty"`
	Conditions *types.RolloverConditions  `json:"conditions,omitempty"`
	Mappings   *types.TypeMapping         `json:"mappings,omitempty"`
	Settings   map[string]json.RawMessage `json:"settings,omitempty"`
}

Request holds the request body struct for the package rollover

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/indices/rollover/IndicesRolloverRequest.ts#L29-L51

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 {
	Acknowledged       bool            `json:"acknowledged"`
	Conditions         map[string]bool `json:"conditions"`
	DryRun             bool            `json:"dry_run"`
	NewIndex           string          `json:"new_index"`
	OldIndex           string          `json:"old_index"`
	RolledOver         bool            `json:"rolled_over"`
	ShardsAcknowledged bool            `json:"shards_acknowledged"`
}

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

type Rollover

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

func New

Updates an alias to point to a new index when the existing index is considered to be too large or too old.

https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html

func (*Rollover) Alias

func (r *Rollover) Alias(v string) *Rollover

Alias The name of the alias to rollover API Name: alias

func (Rollover) Do

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

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

func (*Rollover) DryRun

func (r *Rollover) DryRun(b bool) *Rollover

DryRun If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false API name: dry_run

func (*Rollover) Header

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

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

func (*Rollover) HttpRequest

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

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

func (*Rollover) MasterTimeout

func (r *Rollover) MasterTimeout(v string) *Rollover

MasterTimeout Specify timeout for connection to master API name: master_timeout

func (*Rollover) NewIndex

func (r *Rollover) NewIndex(v string) *Rollover

NewIndex The name of the rollover index API Name: newindex

func (Rollover) Perform

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

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

func (*Rollover) Raw

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

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

func (*Rollover) Request

func (r *Rollover) Request(req *Request) *Rollover

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

func (*Rollover) Timeout

func (r *Rollover) Timeout(v string) *Rollover

Timeout Explicit operation timeout API name: timeout

func (*Rollover) WaitForActiveShards

func (r *Rollover) WaitForActiveShards(v string) *Rollover

WaitForActiveShards Set the number of active shards to wait for on the newly created rollover index before the operation returns. API name: wait_for_active_shards

Jump to

Keyboard shortcuts

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