mget

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: 12 Imported by: 5

Documentation

Overview

Allows to get multiple documents in one request.

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 Mget

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

func (Mget) Do

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

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

func (*Mget) Docs added in v8.9.0

func (r *Mget) Docs(docs ...types.MgetOperation) *Mget

Docs The documents you want to retrieve. Required if no index is specified in the request URI. API name: docs

func (*Mget) ForceSyntheticSource added in v8.13.1

func (r *Mget) ForceSyntheticSource(forcesyntheticsource bool) *Mget

ForceSyntheticSource Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. API name: force_synthetic_source

func (*Mget) Header

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

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

func (*Mget) HttpRequest

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

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

func (*Mget) Ids added in v8.9.0

func (r *Mget) Ids(ids ...string) *Mget

Ids The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI. API name: ids

func (*Mget) Index

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

Index Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. API Name: index

func (Mget) Perform added in v8.7.0

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

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

func (*Mget) Preference

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

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

func (*Mget) Raw

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

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

func (*Mget) Realtime

func (r *Mget) Realtime(realtime bool) *Mget

Realtime If `true`, the request is real-time as opposed to near-real-time. API name: realtime

func (*Mget) Refresh

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

Refresh If `true`, the request refreshes relevant shards before retrieving documents. API name: refresh

func (*Mget) Request

func (r *Mget) Request(req *Request) *Mget

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

func (*Mget) Routing

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

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

func (*Mget) SourceExcludes_

func (r *Mget) SourceExcludes_(fields ...string) *Mget

SourceExcludes_ A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. API name: _source_excludes

func (*Mget) SourceIncludes_

func (r *Mget) SourceIncludes_(fields ...string) *Mget

SourceIncludes_ A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. API name: _source_includes

func (*Mget) Source_

func (r *Mget) Source_(sourceconfigparam string) *Mget

Source_ True or false to return the `_source` field or not, or a list of fields to return. API name: _source

func (*Mget) StoredFields

func (r *Mget) StoredFields(fields ...string) *Mget

StoredFields If `true`, retrieves the document fields stored in the index rather than the document `_source`. API name: stored_fields

type NewMget

type NewMget func() *Mget

NewMget type alias for index.

func NewMgetFunc

func NewMgetFunc(tp elastictransport.Interface) NewMget

NewMgetFunc returns a new instance of Mget 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 {

	// Docs The documents you want to retrieve. Required if no index is specified in the
	// request URI.
	Docs []types.MgetOperation `json:"docs,omitempty"`
	// Ids The IDs of the documents you want to retrieve. Allowed when the index is
	// specified in the request URI.
	Ids []string `json:"ids,omitempty"`
}

Request holds the request body struct for the package mget

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/mget/MultiGetRequest.ts#L25-L98

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 {
	Docs []types.MgetResponseItem `json:"docs"`
}

Response holds the response body struct for the package mget

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/mget/MultiGetResponse.ts#L22-L26

func NewResponse added in v8.7.0

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