rollover

package
v8.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 5

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 Aliases for the target index.
	// Data streams do not support this parameter.
	Aliases map[string]types.Alias `json:"aliases,omitempty"`
	// Conditions Conditions for the rollover.
	// If specified, Elasticsearch only performs the rollover if the current index
	// satisfies these conditions.
	// If this parameter is not specified, Elasticsearch performs the rollover
	// unconditionally.
	// If conditions are specified, at least one of them must be a `max_*`
	// condition.
	// The index will rollover if any `max_*` condition is satisfied and all `min_*`
	// conditions are satisfied.
	Conditions *types.RolloverConditions `json:"conditions,omitempty"`
	// Mappings Mapping for fields in the index.
	// If specified, this mapping can include field names, field data types, and
	// mapping paramaters.
	Mappings *types.TypeMapping `json:"mappings,omitempty"`
	// Settings Configuration options for the index.
	// Data streams do not support this parameter.
	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/3b09f9d8e90178243f8a340a7bc324aab152c602/specification/indices/rollover/IndicesRolloverRequest.ts#L29-L99

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

type Response added in v8.7.0

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 added in v8.7.0

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/{branch}/indices-rollover-index.html

func (*Rollover) Alias

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

Alias Name of the data stream or index alias to roll over. API Name: alias

func (*Rollover) Aliases added in v8.9.0

func (r *Rollover) Aliases(aliases map[string]types.Alias) *Rollover

Aliases Aliases for the target index. Data streams do not support this parameter. API name: aliases

func (*Rollover) Conditions added in v8.9.0

func (r *Rollover) Conditions(conditions *types.RolloverConditions) *Rollover

Conditions Conditions for the rollover. If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. If this parameter is not specified, Elasticsearch performs the rollover unconditionally. If conditions are specified, at least one of them must be a `max_*` condition. The index will rollover if any `max_*` condition is satisfied and all `min_*` conditions are satisfied. API name: conditions

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(dryrun bool) *Rollover

DryRun If `true`, checks whether the current index satisfies the specified conditions but does not perform a rollover. 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) Mappings added in v8.9.0

func (r *Rollover) Mappings(mappings *types.TypeMapping) *Rollover

Mappings Mapping for fields in the index. If specified, this mapping can include field names, field data types, and mapping paramaters. API name: mappings

func (*Rollover) MasterTimeout

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

MasterTimeout Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. API name: master_timeout

func (*Rollover) NewIndex

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

NewIndex Name of the index to create. Supports date math. Data streams do not support this parameter. API Name: newindex

func (Rollover) Perform added in v8.7.0

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) Settings added in v8.9.0

func (r *Rollover) Settings(settings map[string]json.RawMessage) *Rollover

Settings Configuration options for the index. Data streams do not support this parameter. API name: settings

func (*Rollover) Timeout

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

Timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. API name: timeout

func (*Rollover) WaitForActiveShards

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

WaitForActiveShards The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). API name: wait_for_active_shards

Jump to

Keyboard shortcuts

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