deletebyquery

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: 5

Documentation

Overview

Deletes documents matching the provided query.

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 DeleteByQuery

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

func (*DeleteByQuery) AllowNoIndices

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

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 (*DeleteByQuery) AnalyzeWildcard

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

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

func (*DeleteByQuery) Analyzer

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

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

func (*DeleteByQuery) Conflicts

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

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

func (*DeleteByQuery) DefaultOperator

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

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

func (*DeleteByQuery) Df

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

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

func (DeleteByQuery) Do

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

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

func (*DeleteByQuery) ExpandWildcards

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

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 (*DeleteByQuery) From

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

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

func (*DeleteByQuery) Header

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

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

func (*DeleteByQuery) HttpRequest

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

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

func (*DeleteByQuery) IgnoreUnavailable

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

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

func (*DeleteByQuery) Lenient

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

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 (*DeleteByQuery) MaxDocs

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

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

func (DeleteByQuery) Perform added in v8.7.0

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

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

func (*DeleteByQuery) Preference

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

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

func (*DeleteByQuery) Q

Q Query in the Lucene query string syntax. API name: q

func (*DeleteByQuery) Query added in v8.9.0

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

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

func (*DeleteByQuery) Raw

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

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

func (*DeleteByQuery) Refresh

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

Refresh If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. API name: refresh

func (*DeleteByQuery) Request

func (r *DeleteByQuery) Request(req *Request) *DeleteByQuery

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

func (*DeleteByQuery) RequestCache

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

RequestCache If `true`, the request cache is used for this request. Defaults to the index-level setting. API name: request_cache

func (*DeleteByQuery) RequestsPerSecond

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

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

func (*DeleteByQuery) Routing

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

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

func (*DeleteByQuery) Scroll

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

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

func (*DeleteByQuery) ScrollSize

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

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

func (*DeleteByQuery) SearchTimeout

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

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

func (*DeleteByQuery) SearchType

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

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

func (*DeleteByQuery) Slice added in v8.9.0

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

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

func (*DeleteByQuery) Slices

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

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

func (*DeleteByQuery) Sort

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

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

func (*DeleteByQuery) Stats

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

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

func (*DeleteByQuery) TerminateAfter

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

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 (*DeleteByQuery) Timeout

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

Timeout Period each deletion request waits for active shards. API name: timeout

func (*DeleteByQuery) Version

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

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

func (*DeleteByQuery) WaitForActiveShards

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

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

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

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

type NewDeleteByQuery

type NewDeleteByQuery func(index string) *DeleteByQuery

NewDeleteByQuery type alias for index.

func NewDeleteByQueryFunc

func NewDeleteByQueryFunc(tp elastictransport.Interface) NewDeleteByQuery

NewDeleteByQueryFunc returns a new instance of DeleteByQuery 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 {

	// MaxDocs The maximum number of documents to delete.
	MaxDocs *int64 `json:"max_docs,omitempty"`
	// Query Specifies the documents to delete using the Query DSL.
	Query *types.Query `json:"query,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 deletebyquery

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/delete_by_query/DeleteByQueryRequest.ts#L36-L209

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 {
	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"`
	SliceId              *int                             `json:"slice_id,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"`
	VersionConflicts     *int64                           `json:"version_conflicts,omitempty"`
}

Response holds the response body struct for the package deletebyquery

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/delete_by_query/DeleteByQueryResponse.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