msearch

package
v8.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) API. However, similar to the fleet search API, it supports the wait_for_checkpoints parameter.

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 Msearch

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

func New

Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) API. However, similar to the fleet search API, it supports the wait_for_checkpoints parameter.

func (*Msearch) AllowNoIndices

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

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 (*Msearch) AllowPartialSearchResults

func (r *Msearch) AllowPartialSearchResults(allowpartialsearchresults bool) *Msearch

AllowPartialSearchResults If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results` which is true by default. API name: allow_partial_search_results

func (*Msearch) CcsMinimizeRoundtrips

func (r *Msearch) CcsMinimizeRoundtrips(ccsminimizeroundtrips bool) *Msearch

CcsMinimizeRoundtrips If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests. API name: ccs_minimize_roundtrips

func (Msearch) Do

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

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

func (*Msearch) ErrorTrace added in v8.14.0

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

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

func (*Msearch) ExpandWildcards

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

ExpandWildcards Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. API name: expand_wildcards

func (*Msearch) FilterPath added in v8.14.0

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

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

func (*Msearch) Header

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

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

func (*Msearch) HttpRequest

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

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

func (*Msearch) Human added in v8.14.0

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

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_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 (*Msearch) IgnoreThrottled

func (r *Msearch) IgnoreThrottled(ignorethrottled bool) *Msearch

IgnoreThrottled If true, concrete, expanded or aliased indices are ignored when frozen. API name: ignore_throttled

func (*Msearch) IgnoreUnavailable

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

IgnoreUnavailable If true, missing or closed indices are not included in the response. API name: ignore_unavailable

func (*Msearch) Index

func (r *Msearch) Index(index string) *Msearch

Index A single target to search. If the target is an index alias, it must resolve to a single index. API Name: index

func (*Msearch) MaxConcurrentSearches

func (r *Msearch) MaxConcurrentSearches(maxconcurrentsearches string) *Msearch

MaxConcurrentSearches Maximum number of concurrent searches the multi search API can execute. API name: max_concurrent_searches

func (*Msearch) MaxConcurrentShardRequests

func (r *Msearch) MaxConcurrentShardRequests(maxconcurrentshardrequests string) *Msearch

MaxConcurrentShardRequests Maximum number of concurrent shard requests that each sub-search request executes per node. API name: max_concurrent_shard_requests

func (Msearch) Perform

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

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

func (*Msearch) PreFilterShardSize

func (r *Msearch) PreFilterShardSize(prefiltershardsize string) *Msearch

PreFilterShardSize Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. API name: pre_filter_shard_size

func (*Msearch) Pretty added in v8.14.0

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

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

func (*Msearch) Raw

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

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

func (*Msearch) Request

func (r *Msearch) Request(req *Request) *Msearch

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

func (*Msearch) RestTotalHitsAsInt

func (r *Msearch) RestTotalHitsAsInt(resttotalhitsasint bool) *Msearch

RestTotalHitsAsInt If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. API name: rest_total_hits_as_int

func (*Msearch) SearchType

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

SearchType Indicates whether global term and document frequencies should be used when scoring returned documents. API name: search_type

func (*Msearch) TypedKeys

func (r *Msearch) TypedKeys(typedkeys bool) *Msearch

TypedKeys Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. API name: typed_keys

func (*Msearch) WaitForCheckpoints

func (r *Msearch) WaitForCheckpoints(waitforcheckpoints ...int64) *Msearch

WaitForCheckpoints A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search. API name: wait_for_checkpoints

type NewMsearch

type NewMsearch func() *Msearch

NewMsearch type alias for index.

func NewMsearchFunc

func NewMsearchFunc(tp elastictransport.Interface) NewMsearch

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

type Response

type Response struct {
	Docs []types.MsearchResponseItem `json:"docs"`
}

Response holds the response body struct for the package msearch

https://github.com/elastic/elasticsearch-specification/blob/4fcf747dfafc951e1dcf3077327e3dcee9107db3/specification/fleet/msearch/MultiSearchResponse.ts#L25-L29

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

func (*Response) UnmarshalJSON added in v8.12.0

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

Jump to

Keyboard shortcuts

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