getsource

package
v8.19.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Overview

Get a document's source.

Get the source of a document. For example:

``` GET my-index-000001/_source/1 ```

You can use the source filtering parameters to control which parts of the `_source` are returned:

``` GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities ```

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 GetSource

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

func New

Get a document's source.

Get the source of a document. For example:

``` GET my-index-000001/_source/1 ```

You can use the source filtering parameters to control which parts of the `_source` are returned:

``` GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities ```

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

func (GetSource) Do

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

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

func (*GetSource) ErrorTrace added in v8.14.0

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

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

func (*GetSource) FilterPath added in v8.14.0

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

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

func (*GetSource) Header

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

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

func (*GetSource) HttpRequest

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

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

func (*GetSource) Human added in v8.14.0

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

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 (GetSource) IsSuccess

func (r GetSource) IsSuccess(providedCtx context.Context) (bool, error)

IsSuccess allows to run a query with a context and retrieve the result as a boolean. This only exists for endpoints without a request payload and allows for quick control flow.

func (GetSource) Perform added in v8.7.0

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

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

func (*GetSource) Preference

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

Preference The node or shard the operation should be performed on. By default, the operation is randomized between the shard replicas. API name: preference

func (*GetSource) Pretty added in v8.14.0

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

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

func (*GetSource) Realtime

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

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

func (*GetSource) Refresh

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

Refresh If `true`, the request refreshes the relevant shards before retrieving the document. Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). API name: refresh

func (*GetSource) Routing

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

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

func (*GetSource) SourceExcludes_

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

SourceExcludes_ A comma-separated list of source fields to exclude in the response. API name: _source_excludes

func (*GetSource) SourceIncludes_

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

SourceIncludes_ A comma-separated list of source fields to include in the response. API name: _source_includes

func (*GetSource) Source_

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

Source_ Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. API name: _source

func (*GetSource) Version

func (r *GetSource) Version(versionnumber string) *GetSource

Version The version number for concurrency control. It must match the current version of the document for the request to succeed. API name: version

func (*GetSource) VersionType

func (r *GetSource) VersionType(versiontype versiontype.VersionType) *GetSource

VersionType The version type. API name: version_type

type NewGetSource

type NewGetSource func(index, id string) *GetSource

NewGetSource type alias for index.

func NewGetSourceFunc

func NewGetSourceFunc(tp elastictransport.Interface) NewGetSource

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

type Response added in v8.7.0

type Response = json.RawMessage

func NewResponse added in v8.7.1

func NewResponse() *Response

Jump to

Keyboard shortcuts

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