renderquery

package
v9.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Render a search application query. Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. If a parameter used in the search template is not specified in `params`, the parameter's default value will be used. The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

You must have `read` privileges on the backing alias of the search application.

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 NewRenderQuery

type NewRenderQuery func(name string) *RenderQuery

NewRenderQuery type alias for index.

func NewRenderQueryFunc

func NewRenderQueryFunc(tp elastictransport.Interface) NewRenderQuery

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

type RenderQuery

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

func New

Render a search application query. Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. If a parameter used in the search template is not specified in `params`, the parameter's default value will be used. The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

You must have `read` privileges on the backing alias of the search application.

https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-render-query

func (*RenderQuery) AddParam

func (r *RenderQuery) AddParam(key string, value json.RawMessage) *RenderQuery

func (RenderQuery) Do

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

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

func (*RenderQuery) ErrorTrace

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

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

func (*RenderQuery) FilterPath

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

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

func (*RenderQuery) Header

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

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

func (*RenderQuery) HttpRequest

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

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

func (*RenderQuery) Human

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

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 (*RenderQuery) Params

func (r *RenderQuery) Params(params map[string]json.RawMessage) *RenderQuery

API name: params

func (RenderQuery) Perform

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

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

func (*RenderQuery) Pretty

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

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

func (*RenderQuery) Raw

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

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

func (*RenderQuery) Request

func (r *RenderQuery) Request(req *Request) *RenderQuery

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

type Request

type Request struct {
	Params map[string]json.RawMessage `json:"params,omitempty"`
}

Request holds the request body struct for the package renderquery

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/search_application/render_query/SearchApplicationsRenderQueryRequest.ts#L24-L54

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

type Response

type Response struct {
}

Response holds the response body struct for the package renderquery

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/search_application/render_query/SearchApplicationsRenderQueryResponse.ts#L20-L22

func NewResponse

func NewResponse() *Response

NewResponse returns a Response