updatebyquery

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: 16 Imported by: 4

Documentation

Overview

Updates documents that match the specified query. If no query is specified,

performs an update on every document in the index without changing the

source, for example to pick up a mapping change.

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 NewUpdateByQuery

type NewUpdateByQuery func(index string) *UpdateByQuery

NewUpdateByQuery type alias for index.

func NewUpdateByQueryFunc

func NewUpdateByQueryFunc(tp elastictransport.Interface) NewUpdateByQuery

NewUpdateByQueryFunc returns a new instance of UpdateByQuery 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 {

	// Conflicts What to do if update by query hits version conflicts: `abort` or `proceed`.
	Conflicts *conflicts.Conflicts `json:"conflicts,omitempty"`
	// MaxDocs The maximum number of documents to update.
	MaxDocs *int64 `json:"max_docs,omitempty"`
	// Query Specifies the documents to update using the Query DSL.
	Query *types.Query `json:"query,omitempty"`
	// Script The script to run to update the document source or metadata when updating.
	Script types.Script `json:"script,omitempty"`
	// Slice Slice the request manually using the provided slice ID and total number of
	// slices.
	Slice *types.SlicedScroll `json:"slice,omitempty"`
}

Request holds the request body struct for the package updatebyquery

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/update_by_query/UpdateByQueryRequest.ts#L37-L221

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"`
	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"`
	Task                 types.TaskId                     `json:"task,omitempty"`
	Throttled            types.Duration                   `json:"throttled,omitempty"`
	ThrottledMillis      *int64                           `json:"throttled_millis,omitempty"`
	ThrottledUntil       types.Duration                   `json:"throttled_until,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 updatebyquery

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

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

type UpdateByQuery

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

func New

Updates documents that match the specified query. If no query is specified,

performs an update on every document in the index without changing the

source, for example to pick up a mapping change.

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html

func (*UpdateByQuery) AllowNoIndices

func (r *UpdateByQuery) AllowNoIndices(allownoindices bool) *UpdateByQuery

AllowNoIndices If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. API name: allow_no_indices

func (*UpdateByQuery) AnalyzeWildcard

func (r *UpdateByQuery) AnalyzeWildcard(analyzewildcard bool) *UpdateByQuery

AnalyzeWildcard If `true`, wildcard and prefix queries are analyzed. API name: analyze_wildcard

func (*UpdateByQuery) Analyzer

func (r *UpdateByQuery) Analyzer(analyzer string) *UpdateByQuery

Analyzer Analyzer to use for the query string. API name: analyzer

func (*UpdateByQuery) Conflicts

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

Conflicts What to do if update by query hits version conflicts: `abort` or `proceed`. API name: conflicts

func (*UpdateByQuery) DefaultOperator

func (r *UpdateByQuery) DefaultOperator(defaultoperator operator.Operator) *UpdateByQuery

DefaultOperator The default operator for query string query: `AND` or `OR`. API name: default_operator

func (*UpdateByQuery) Df

func (r *UpdateByQuery) Df(df string) *UpdateByQuery

Df Field to use as default where no field prefix is given in the query string. API name: df

func (UpdateByQuery) Do

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

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

func (*UpdateByQuery) ExpandWildcards

func (r *UpdateByQuery) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *UpdateByQuery

ExpandWildcards Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. API name: expand_wildcards

func (*UpdateByQuery) From

func (r *UpdateByQuery) From(from string) *UpdateByQuery

From Starting offset (default: 0) API name: from

func (*UpdateByQuery) Header

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

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

func (*UpdateByQuery) HttpRequest

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

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

func (*UpdateByQuery) IgnoreUnavailable

func (r *UpdateByQuery) IgnoreUnavailable(ignoreunavailable bool) *UpdateByQuery

IgnoreUnavailable If `false`, the request returns an error if it targets a missing or closed index. API name: ignore_unavailable

func (*UpdateByQuery) Lenient

func (r *UpdateByQuery) Lenient(lenient bool) *UpdateByQuery

Lenient If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. API name: lenient

func (*UpdateByQuery) MaxDocs

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

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

func (UpdateByQuery) Perform added in v8.7.0

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

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

func (*UpdateByQuery) Pipeline

func (r *UpdateByQuery) Pipeline(pipeline string) *UpdateByQuery

Pipeline ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. API name: pipeline

func (*UpdateByQuery) Preference

func (r *UpdateByQuery) Preference(preference string) *UpdateByQuery

Preference Specifies the node or shard the operation should be performed on. Random by default. API name: preference

func (*UpdateByQuery) Query added in v8.9.0

func (r *UpdateByQuery) Query(query *types.Query) *UpdateByQuery

Query Specifies the documents to update using the Query DSL. API name: query

func (*UpdateByQuery) Raw

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

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

func (*UpdateByQuery) Refresh

func (r *UpdateByQuery) Refresh(refresh bool) *UpdateByQuery

Refresh If `true`, Elasticsearch refreshes affected shards to make the operation visible to search. API name: refresh

func (*UpdateByQuery) Request

func (r *UpdateByQuery) Request(req *Request) *UpdateByQuery

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

func (*UpdateByQuery) RequestCache

func (r *UpdateByQuery) RequestCache(requestcache bool) *UpdateByQuery

RequestCache If `true`, the request cache is used for this request. API name: request_cache

func (*UpdateByQuery) RequestsPerSecond

func (r *UpdateByQuery) RequestsPerSecond(requestspersecond string) *UpdateByQuery

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

func (*UpdateByQuery) Routing

func (r *UpdateByQuery) Routing(routing string) *UpdateByQuery

Routing Custom value used to route operations to a specific shard. API name: routing

func (*UpdateByQuery) Script added in v8.9.0

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

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

func (*UpdateByQuery) Scroll

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

Scroll Period to retain the search context for scrolling. API name: scroll

func (*UpdateByQuery) ScrollSize

func (r *UpdateByQuery) ScrollSize(scrollsize string) *UpdateByQuery

ScrollSize Size of the scroll request that powers the operation. API name: scroll_size

func (*UpdateByQuery) SearchTimeout

func (r *UpdateByQuery) SearchTimeout(duration string) *UpdateByQuery

SearchTimeout Explicit timeout for each search request. API name: search_timeout

func (*UpdateByQuery) SearchType

func (r *UpdateByQuery) SearchType(searchtype searchtype.SearchType) *UpdateByQuery

SearchType The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. API name: search_type

func (*UpdateByQuery) Slice added in v8.9.0

func (r *UpdateByQuery) Slice(slice *types.SlicedScroll) *UpdateByQuery

Slice Slice the request manually using the provided slice ID and total number of slices. API name: slice

func (*UpdateByQuery) Slices

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

Slices The number of slices this task should be divided into. API name: slices

func (*UpdateByQuery) Sort

func (r *UpdateByQuery) Sort(sorts ...string) *UpdateByQuery

Sort A comma-separated list of <field>:<direction> pairs. API name: sort

func (*UpdateByQuery) Stats

func (r *UpdateByQuery) Stats(stats ...string) *UpdateByQuery

Stats Specific `tag` of the request for logging and statistical purposes. API name: stats

func (*UpdateByQuery) TerminateAfter

func (r *UpdateByQuery) TerminateAfter(terminateafter string) *UpdateByQuery

TerminateAfter Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. API name: terminate_after

func (*UpdateByQuery) Timeout

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

Timeout Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. API name: timeout

func (*UpdateByQuery) Version

func (r *UpdateByQuery) Version(version bool) *UpdateByQuery

Version If `true`, returns the document version as part of a hit. API name: version

func (*UpdateByQuery) VersionType

func (r *UpdateByQuery) VersionType(versiontype bool) *UpdateByQuery

VersionType Should the document increment the version number (internal) on hit or not (reindex) API name: version_type

func (*UpdateByQuery) WaitForActiveShards

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

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 (*UpdateByQuery) WaitForCompletion

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

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

Jump to

Keyboard shortcuts

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