getscript

package
v9.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Get a script or search template. Retrieves a stored script or search template.

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 GetScript

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

func New

Get a script or search template. Retrieves a stored script or search template.

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get-script

func (GetScript) Do

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

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

func (*GetScript) ErrorTrace

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

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

func (*GetScript) FilterPath

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

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

func (*GetScript) Header

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

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

func (*GetScript) HttpRequest

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

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

func (*GetScript) Human

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

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

func (r GetScript) 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 (*GetScript) MasterTimeout

func (r *GetScript) MasterTimeout(duration string) *GetScript

MasterTimeout The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. It can also be set to `-1` to indicate that the request should never timeout. API name: master_timeout

func (GetScript) Perform

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

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

func (*GetScript) Pretty

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

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

type NewGetScript

type NewGetScript func(id string) *GetScript

NewGetScript type alias for index.

func NewGetScriptFunc

func NewGetScriptFunc(tp elastictransport.Interface) NewGetScript

NewGetScriptFunc returns a new instance of GetScript 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 {
	Found  bool                `json:"found"`
	Id_    string              `json:"_id"`
	Script *types.StoredScript `json:"script,omitempty"`
}

Response holds the response body struct for the package getscript

https://github.com/elastic/elasticsearch-specification/blob/907d11a72a6bfd37b777d526880c56202889609e/specification/_global/get_script/GetScriptResponse.ts#L23-L29

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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