reindex

package
v8.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

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/current/docs-reindex.html

func (*Reindex) Conflicts added in v8.9.0

func (r *Reindex) Conflicts(conflicts conflicts.Conflicts) *Reindex

Conflicts Set to proceed to continue reindexing even if there are conflicts. API name: conflicts

func (*Reindex) Dest added in v8.9.0

func (r *Reindex) Dest(dest *types.ReindexDestination) *Reindex

Dest The destination you are copying to. API name: dest

func (Reindex) Do

func (r Reindex) Do(providedCtx 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) MaxDocs added in v8.9.0

func (r *Reindex) MaxDocs(maxdocs int64) *Reindex

MaxDocs The maximum number of documents to reindex. API name: max_docs

func (Reindex) Perform added in v8.7.0

func (r Reindex) Perform(providedCtx 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(refresh bool) *Reindex

Refresh If `true`, the request refreshes affected shards to make this operation visible to search. 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(requestspersecond string) *Reindex

RequestsPerSecond The throttle for this request in sub-requests per second. Defaults to no throttle. API name: requests_per_second

func (*Reindex) RequireAlias

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

RequireAlias If `true`, the destination must be an index alias. API name: require_alias

func (*Reindex) Script added in v8.9.0

func (r *Reindex) Script(script types.Script) *Reindex

Script The script to run to update the document source or metadata when reindexing. API name: script

func (*Reindex) Scroll

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

Scroll Specifies how long a consistent view of the index should be maintained for scrolled search. API name: scroll

func (*Reindex) Size added in v8.9.0

func (r *Reindex) Size(size int64) *Reindex

API name: size

func (*Reindex) Slices

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

Slices The number of slices this task should be divided into. Defaults to 1 slice, meaning the task isn’t sliced into subtasks. API name: slices

func (*Reindex) Source added in v8.9.0

func (r *Reindex) Source(source *types.ReindexSource) *Reindex

Source The source you are copying from. API name: source

func (*Reindex) Timeout

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

Timeout Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. API name: timeout

func (*Reindex) WaitForActiveShards

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

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

func (*Reindex) WaitForCompletion

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

WaitForCompletion If `true`, the request blocks until the operation is complete. API name: wait_for_completion

type Request

type Request struct {

	// Conflicts Set to proceed to continue reindexing even if there are conflicts.
	Conflicts *conflicts.Conflicts `json:"conflicts,omitempty"`
	// Dest The destination you are copying to.
	Dest types.ReindexDestination `json:"dest"`
	// MaxDocs The maximum number of documents to reindex.
	MaxDocs *int64 `json:"max_docs,omitempty"`
	// Script The script to run to update the document source or metadata when reindexing.
	Script types.Script `json:"script,omitempty"`
	Size   *int64       `json:"size,omitempty"`
	// Source The source you are copying from.
	Source types.ReindexSource `json:"source"`
}

Request holds the request body struct for the package reindex

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/reindex/ReindexRequest.ts#L27-L101

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

func (*Request) UnmarshalJSON added in v8.12.1

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

type Response added in v8.7.0

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"`
}

Response holds the response body struct for the package reindex

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/reindex/ReindexResponse.ts#L26-L45

func NewResponse added in v8.7.0

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