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 ¶
- Variables
- type GetSource
- func (r GetSource) Do(providedCtx context.Context) (Response, error)
- func (r *GetSource) ErrorTrace(errortrace bool) *GetSource
- func (r *GetSource) FilterPath(filterpaths ...string) *GetSource
- func (r *GetSource) Header(key, value string) *GetSource
- func (r *GetSource) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *GetSource) Human(human bool) *GetSource
- func (r GetSource) IsSuccess(providedCtx context.Context) (bool, error)
- func (r GetSource) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *GetSource) Preference(preference string) *GetSource
- func (r *GetSource) Pretty(pretty bool) *GetSource
- func (r *GetSource) Realtime(realtime bool) *GetSource
- func (r *GetSource) Refresh(refresh bool) *GetSource
- func (r *GetSource) Routing(routing string) *GetSource
- func (r *GetSource) SourceExcludes_(fields ...string) *GetSource
- func (r *GetSource) SourceIncludes_(fields ...string) *GetSource
- func (r *GetSource) Source_(sourceconfigparam string) *GetSource
- func (r *GetSource) Version(versionnumber string) *GetSource
- func (r *GetSource) VersionType(versiontype versiontype.VersionType) *GetSource
- type NewGetSource
- 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 ¶
type GetSource ¶
type GetSource struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *GetSource
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 ¶
Do runs the request through the transport, handle the response and returns a getsource.Response
func (*GetSource) ErrorTrace ¶ added in v8.14.0
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
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*GetSource) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*GetSource) Human ¶ added in v8.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 human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human
func (GetSource) IsSuccess ¶
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
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*GetSource) Preference ¶
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
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 ¶
Realtime If `true`, the request is real-time as opposed to near-real-time. API name: realtime
func (*GetSource) Refresh ¶
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 ¶
Routing A custom value used to route operations to a specific shard. API name: routing
func (*GetSource) SourceExcludes_ ¶
SourceExcludes_ A comma-separated list of source fields to exclude in the response. API name: _source_excludes
func (*GetSource) SourceIncludes_ ¶
SourceIncludes_ A comma-separated list of source fields to include in the response. API name: _source_includes
func (*GetSource) Source_ ¶
Source_ Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. API name: _source
func (*GetSource) Version ¶
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 ¶
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