mget
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Get multiple documents.
Get multiple JSON documents by ID from one or more indices.If you specify an index in the request URI, you only need to specify thedocument IDs in the request body.To ensure fast responses, this multi get (mget) API responds with partialresults if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).Use the `_source` and `_source_include` or `source_exclude` attributes tofilter what fields are returned for a particular document.You can include the `_source`, `_source_includes`, and `_source_excludes`query parameters in the request URI to specify the defaults to use when thereare no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields youwant to retrieve.Any requested fields that are not stored are ignored.You can include the `stored_fields` query parameter in the request URI tospecify the defaults to use when there are no per-document instructions.
Index¶
- Variables
- type Mget
- func (r Mget) Do(providedCtx context.Context) (*Response, error)
- func (r *Mget) Docs(docs ...types.MgetOperation) *Mget
- func (r *Mget) ErrorTrace(errortrace bool) *Mget
- func (r *Mget) FilterPath(filterpaths ...string) *Mget
- func (r *Mget) ForceSyntheticSource(forcesyntheticsource bool) *Mget
- func (r *Mget) Header(key, value string) *Mget
- func (r *Mget) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Mget) Human(human bool) *Mget
- func (r *Mget) Ids(ids ...string) *Mget
- func (r *Mget) Index(index string) *Mget
- func (r Mget) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Mget) Preference(preference string) *Mget
- func (r *Mget) Pretty(pretty bool) *Mget
- func (r *Mget) Raw(raw io.Reader) *Mget
- func (r *Mget) Realtime(realtime bool) *Mget
- func (r *Mget) Refresh(refresh bool) *Mget
- func (r *Mget) Request(req *Request) *Mget
- func (r *Mget) Routing(routing string) *Mget
- func (r *Mget) SourceExcludes_(fields ...string) *Mget
- func (r *Mget) SourceIncludes_(fields ...string) *Mget
- func (r *Mget) Source_(sourceconfigparam string) *Mget
- func (r *Mget) StoredFields(fields ...string) *Mget
- type NewMget
- type Request
- type Response
Constants¶
This section is empty.
Variables¶
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¶
typeMget¶
type Mget struct {// contains filtered or unexported fields}funcNew¶
func New(tpelastictransport.Interface) *Mget
Get multiple documents.
Get multiple JSON documents by ID from one or more indices.If you specify an index in the request URI, you only need to specify thedocument IDs in the request body.To ensure fast responses, this multi get (mget) API responds with partialresults if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).Use the `_source` and `_source_include` or `source_exclude` attributes tofilter what fields are returned for a particular document.You can include the `_source`, `_source_includes`, and `_source_excludes`query parameters in the request URI to specify the defaults to use when thereare no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields youwant to retrieve.Any requested fields that are not stored are ignored.You can include the `stored_fields` query parameter in the request URI tospecify the defaults to use when there are no per-document instructions.
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
func (Mget)Do¶
Do runs the request through the transport, handle the response and returns a mget.Response
func (*Mget)Docs¶added inv8.9.0
func (r *Mget) Docs(docs ...types.MgetOperation) *Mget
Docs The documents you want to retrieve. Required if no index is specified in therequest URI.API name: docs
func (*Mget)ErrorTrace¶added inv8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace
func (*Mget)FilterPath¶added inv8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path
func (*Mget)ForceSyntheticSource¶added inv8.13.1
ForceSyntheticSource Should this request force synthetic _source?Use this to test if the mapping supports synthetic _source and to get a senseof the worst case performance.Fetches with this enabled will be slower the enabling synthetic sourcenatively in the index.API name: force_synthetic_source
func (*Mget)HttpRequest¶
HttpRequest returns the http.Request object built from thegiven parameters.
func (*Mget)Human¶added inv8.14.0
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 humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human
func (*Mget)Ids¶added inv8.9.0
Ids The IDs of the documents you want to retrieve. Allowed when the index isspecified in the request URI.API name: ids
func (*Mget)Index¶
Index Name of the index to retrieve documents from when `ids` are specified, orwhen a document in the `docs` array does not specify an index.API Name: index
func (Mget)Perform¶added inv8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Mget)Preference¶
Preference Specifies the node or shard the operation should be performed on. Random bydefault.API name: preference
func (*Mget)Pretty¶added inv8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty
func (*Mget)Raw¶
Raw takes a json payload as input which is then passed to the http.RequestIf specified Raw takes precedence on Request method.
func (*Mget)Realtime¶
Realtime If `true`, the request is real-time as opposed to near-real-time.API name: realtime
func (*Mget)Refresh¶
Refresh If `true`, the request refreshes relevant shards before retrieving documents.API name: refresh
func (*Mget)Routing¶
Routing Custom value used to route operations to a specific shard.API name: routing
func (*Mget)SourceExcludes_¶
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 specifiedin `_source_includes` query parameter.API name: _source_excludes
func (*Mget)SourceIncludes_¶
SourceIncludes_ A comma-separated list of source fields to include in the response.If this parameter is specified, only these source fields are returned. Youcan exclude fields from this subset using the `_source_excludes` queryparameter.If the `_source` parameter is `false`, this parameter is ignored.API name: _source_includes
func (*Mget)Source_¶
Source_ True or false to return the `_source` field or not, or a list of fields toreturn.API name: _source
func (*Mget)StoredFields¶
StoredFields If `true`, retrieves the document fields stored in the index rather than thedocument `_source`.API name: stored_fields
typeNewMget¶
type NewMget func() *Mget
NewMget type alias for index.
funcNewMgetFunc¶
func NewMgetFunc(tpelastictransport.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.
typeRequest¶
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
func (*Request)FromJSON¶added inv8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request)UnmarshalJSON¶added inv8.12.1
typeResponse¶added inv8.7.0
type Response struct {// Docs The response includes a docs array that contains the documents in the order// specified in the request.// The structure of the returned documents is similar to that returned by the// get API.// If there is a failure getting a particular document, the error is included in// place of the document.Docs []types.MgetResponseItem `json:"docs"`}Response holds the response body struct for the package mget