follow

package
v9.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Create a follower. Create a cross-cluster replication follower index that follows a specific leader index. When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

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 Follow

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

func New

Create a follower. Create a cross-cluster replication follower index that follows a specific leader index. When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-follow

func (*Follow) DataStreamName

func (r *Follow) DataStreamName(datastreamname string) *Follow

If the leader index is part of a data stream, the name to which the local data stream for the followed index should be renamed. API name: data_stream_name

func (Follow) Do

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

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

func (*Follow) ErrorTrace

func (r *Follow) ErrorTrace(errortrace bool) *Follow

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*Follow) FilterPath

func (r *Follow) FilterPath(filterpaths ...string) *Follow

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*Follow) Header

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

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

func (*Follow) HttpRequest

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

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

func (*Follow) Human

func (r *Follow) Human(human bool) *Follow

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"exists_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (*Follow) LeaderIndex

func (r *Follow) LeaderIndex(indexname string) *Follow

The name of the index in the leader cluster to follow. API name: leader_index

func (*Follow) MasterTimeout

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

MasterTimeout Period to wait for a connection to the master node. API name: master_timeout

func (*Follow) MaxOutstandingReadRequests

func (r *Follow) MaxOutstandingReadRequests(maxoutstandingreadrequests int64) *Follow

The maximum number of outstanding reads requests from the remote cluster. API name: max_outstanding_read_requests

func (*Follow) MaxOutstandingWriteRequests

func (r *Follow) MaxOutstandingWriteRequests(maxoutstandingwriterequests int) *Follow

The maximum number of outstanding write requests on the follower. API name: max_outstanding_write_requests

func (*Follow) MaxReadRequestOperationCount

func (r *Follow) MaxReadRequestOperationCount(maxreadrequestoperationcount int) *Follow

The maximum number of operations to pull per read from the remote cluster. API name: max_read_request_operation_count

func (*Follow) MaxReadRequestSize

func (r *Follow) MaxReadRequestSize(bytesize types.ByteSizeVariant) *Follow

The maximum size in bytes of per read of a batch of operations pulled from the remote cluster. API name: max_read_request_size

func (*Follow) MaxRetryDelay

func (r *Follow) MaxRetryDelay(duration types.DurationVariant) *Follow

The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying. API name: max_retry_delay

func (*Follow) MaxWriteBufferCount

func (r *Follow) MaxWriteBufferCount(maxwritebuffercount int) *Follow

The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit. API name: max_write_buffer_count

func (*Follow) MaxWriteBufferSize

func (r *Follow) MaxWriteBufferSize(bytesize types.ByteSizeVariant) *Follow

The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit. API name: max_write_buffer_size

func (*Follow) MaxWriteRequestOperationCount

func (r *Follow) MaxWriteRequestOperationCount(maxwriterequestoperationcount int) *Follow

The maximum number of operations per bulk write request executed on the follower. API name: max_write_request_operation_count

func (*Follow) MaxWriteRequestSize

func (r *Follow) MaxWriteRequestSize(bytesize types.ByteSizeVariant) *Follow

The maximum total bytes of operations per bulk write request executed on the follower. API name: max_write_request_size

func (Follow) Perform

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

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

func (*Follow) Pretty

func (r *Follow) Pretty(pretty bool) *Follow

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*Follow) Raw

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

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

func (*Follow) ReadPollTimeout

func (r *Follow) ReadPollTimeout(duration types.DurationVariant) *Follow

The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again. API name: read_poll_timeout

func (*Follow) RemoteCluster

func (r *Follow) RemoteCluster(remotecluster string) *Follow

The remote cluster containing the leader index. API name: remote_cluster

func (*Follow) Request

func (r *Follow) Request(req *Request) *Follow

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

func (*Follow) Settings

func (r *Follow) Settings(settings types.IndexSettingsVariant) *Follow

Settings to override from the leader index. API name: settings

func (*Follow) WaitForActiveShards

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

WaitForActiveShards Specifies the number of shards to wait on being active before responding. This defaults to waiting on none of the shards to be active. A shard must be restored from the leader index before being active. Restoring a follower shard requires transferring all the remote Lucene segment files to the follower index. API name: wait_for_active_shards

type NewFollow

type NewFollow func(index string) *Follow

NewFollow type alias for index.

func NewFollowFunc

func NewFollowFunc(tp elastictransport.Interface) NewFollow

NewFollowFunc returns a new instance of Follow 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 {

	// DataStreamName If the leader index is part of a data stream, the name to which the local
	// data stream for the followed index should be renamed.
	DataStreamName *string `json:"data_stream_name,omitempty"`
	// LeaderIndex The name of the index in the leader cluster to follow.
	LeaderIndex string `json:"leader_index"`
	// MaxOutstandingReadRequests The maximum number of outstanding reads requests from the remote cluster.
	MaxOutstandingReadRequests *int64 `json:"max_outstanding_read_requests,omitempty"`
	// MaxOutstandingWriteRequests The maximum number of outstanding write requests on the follower.
	MaxOutstandingWriteRequests *int `json:"max_outstanding_write_requests,omitempty"`
	// MaxReadRequestOperationCount The maximum number of operations to pull per read from the remote cluster.
	MaxReadRequestOperationCount *int `json:"max_read_request_operation_count,omitempty"`
	// MaxReadRequestSize The maximum size in bytes of per read of a batch of operations pulled from
	// the remote cluster.
	MaxReadRequestSize types.ByteSize `json:"max_read_request_size,omitempty"`
	// MaxRetryDelay The maximum time to wait before retrying an operation that failed
	// exceptionally. An exponential backoff strategy is employed when
	// retrying.
	MaxRetryDelay types.Duration `json:"max_retry_delay,omitempty"`
	// MaxWriteBufferCount The maximum number of operations that can be queued for writing. When this
	// limit is reached, reads from the remote cluster will be
	// deferred until the number of queued operations goes below the limit.
	MaxWriteBufferCount *int `json:"max_write_buffer_count,omitempty"`
	// MaxWriteBufferSize The maximum total bytes of operations that can be queued for writing. When
	// this limit is reached, reads from the remote cluster will
	// be deferred until the total bytes of queued operations goes below the limit.
	MaxWriteBufferSize types.ByteSize `json:"max_write_buffer_size,omitempty"`
	// MaxWriteRequestOperationCount The maximum number of operations per bulk write request executed on the
	// follower.
	MaxWriteRequestOperationCount *int `json:"max_write_request_operation_count,omitempty"`
	// MaxWriteRequestSize The maximum total bytes of operations per bulk write request executed on the
	// follower.
	MaxWriteRequestSize types.ByteSize `json:"max_write_request_size,omitempty"`
	// ReadPollTimeout The maximum time to wait for new operations on the remote cluster when the
	// follower index is synchronized with the leader index.
	// When the timeout has elapsed, the poll for operations will return to the
	// follower so that it can update some statistics.
	// Then the follower will immediately attempt to read from the leader again.
	ReadPollTimeout types.Duration `json:"read_poll_timeout,omitempty"`
	// RemoteCluster The remote cluster containing the leader index.
	RemoteCluster string `json:"remote_cluster"`
	// Settings Settings to override from the leader index.
	Settings *types.IndexSettings `json:"settings,omitempty"`
}

Request holds the request body struct for the package follow

https://github.com/elastic/elasticsearch-specification/blob/907d11a72a6bfd37b777d526880c56202889609e/specification/ccr/follow/CreateFollowIndexRequest.ts#L26-L124

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

func (*Request) UnmarshalJSON

func (s *Request) UnmarshalJSON(data []byte) error

type Response

type Response struct {
	FollowIndexCreated     bool `json:"follow_index_created"`
	FollowIndexShardsAcked bool `json:"follow_index_shards_acked"`
	IndexFollowingStarted  bool `json:"index_following_started"`
}

Response holds the response body struct for the package follow

https://github.com/elastic/elasticsearch-specification/blob/907d11a72a6bfd37b777d526880c56202889609e/specification/ccr/follow/CreateFollowIndexResponse.ts#L20-L26

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