reindex

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

Documentation

Overview

Allows to copy documents from one index to another, optionally filtering the source documents by a query, changing the destination index settings, or fetching the documents from a remote cluster.

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 NewReindex

type NewReindex func() *Reindex

NewReindex type alias for index.

func NewReindexFunc

func NewReindexFunc(tp elastictransport.Interface) NewReindex

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

type Reindex

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

func New

Allows to copy documents from one index to another, optionally filtering the source documents by a query, changing the destination index settings, or fetching the documents from a remote cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html

func (Reindex) Do

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

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

func (*Reindex) Header

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

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

func (*Reindex) HttpRequest

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

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

func (Reindex) Perform

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

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

func (*Reindex) Raw

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

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

func (*Reindex) Refresh

func (r *Reindex) Refresh(b bool) *Reindex

Refresh Should the affected indexes be refreshed? API name: refresh

func (*Reindex) Request

func (r *Reindex) Request(req *Request) *Reindex

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

func (*Reindex) RequestsPerSecond

func (r *Reindex) RequestsPerSecond(v string) *Reindex

RequestsPerSecond The throttle to set on this request in sub-requests per second. -1 means no throttle. API name: requests_per_second

func (*Reindex) RequireAlias

func (r *Reindex) RequireAlias(b bool) *Reindex

API name: require_alias

func (*Reindex) Scroll

func (r *Reindex) Scroll(v string) *Reindex

Scroll Control how long to keep the search context alive API name: scroll

func (*Reindex) Slices

func (r *Reindex) Slices(v string) *Reindex

Slices The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. API name: slices

func (*Reindex) Timeout

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

Timeout Time each individual bulk request should wait for shards that are unavailable. API name: timeout

func (*Reindex) WaitForActiveShards

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

WaitForActiveShards Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) API name: wait_for_active_shards

func (*Reindex) WaitForCompletion

func (r *Reindex) WaitForCompletion(b bool) *Reindex

WaitForCompletion Should the request should block until the reindex is complete. API name: wait_for_completion

type Request

type Request struct {
	Conflicts *conflicts.Conflicts     `json:"conflicts,omitempty"`
	Dest      types.ReindexDestination `json:"dest"`
	MaxDocs   *int64                   `json:"max_docs,omitempty"`
	Script    types.Script             `json:"script,omitempty"`
	Size      *int64                   `json:"size,omitempty"`
	Source    types.ReindexSource      `json:"source"`
}

Request holds the request body struct for the package reindex

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/_global/reindex/ReindexRequest.ts#L27-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 {
	Batches              *int64                           `json:"batches,omitempty"`
	Created              *int64                           `json:"created,omitempty"`
	Deleted              *int64                           `json:"deleted,omitempty"`
	Failures             []types.BulkIndexByScrollFailure `json:"failures,omitempty"`
	Noops                *int64                           `json:"noops,omitempty"`
	RequestsPerSecond    *float32                         `json:"requests_per_second,omitempty"`
	Retries              *types.Retries                   `json:"retries,omitempty"`
	SliceId              *int                             `json:"slice_id,omitempty"`
	Task                 types.TaskId                     `json:"task,omitempty"`
	ThrottledMillis      *int64                           `json:"throttled_millis,omitempty"`
	ThrottledUntilMillis *int64                           `json:"throttled_until_millis,omitempty"`
	TimedOut             *bool                            `json:"timed_out,omitempty"`
	Took                 *int64                           `json:"took,omitempty"`
	Total                *int64                           `json:"total,omitempty"`
	Updated              *int64                           `json:"updated,omitempty"`
	VersionConflicts     *int64                           `json:"version_conflicts,omitempty"`
}

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