Documentation
¶
Overview ¶
Executes an ES|QL request
Index ¶
- Variables
- func Helper[T any](ctx context.Context, esqlQuery *Query) ([]T, error)
- type EsqlIterator
- type NewQuery
- type Query
- func (r *Query) Columnar(columnar bool) *Query
- func (r *Query) Delimiter(delimiter string) *Query
- func (r Query) Do(providedCtx context.Context) (Response, error)
- func (r *Query) ErrorTrace(errortrace bool) *Query
- func (r *Query) Filter(filter *types.Query) *Query
- func (r *Query) FilterPath(filterpaths ...string) *Query
- func (r *Query) Format(format string) *Query
- func (r *Query) Header(key, value string) *Query
- func (r *Query) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Query) Human(human bool) *Query
- func (r *Query) Locale(locale string) *Query
- func (r *Query) Params(params ...types.ScalarValue) *Query
- func (r Query) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Query) Pretty(pretty bool) *Query
- func (r *Query) Query(query string) *Query
- func (r *Query) Raw(raw io.Reader) *Query
- func (r *Query) Request(req *Request) *Query
- 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 ¶
Types ¶
type EsqlIterator ¶ added in v8.14.0
func NewIteratorHelper ¶ added in v8.14.0
Helper takes a generic type T, a context.Context and an esql.Query request buffer the response and provides an API to consume one item at a time.
type NewQuery ¶
type NewQuery func() *Query
NewQuery type alias for index.
func NewQueryFunc ¶
func NewQueryFunc(tp elastictransport.Interface) NewQuery
NewQueryFunc returns a new instance of Query with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Query
Executes an ES|QL request
https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-rest.html
func (*Query) Columnar ¶
Columnar By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. API name: columnar
func (*Query) Delimiter ¶
Delimiter The character to use between values within a CSV row. Only valid for the CSV format. API name: delimiter
func (Query) Do ¶
Do runs the request through the transport, handle the response and returns a query.Response
func (*Query) 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 (*Query) Filter ¶
Filter Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. API name: filter
func (*Query) 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 (*Query) Format ¶
Format A short version of the Accept header, e.g. json, yaml. API name: format
func (*Query) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Query) 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 (*Query) Params ¶
func (r *Query) Params(params ...types.ScalarValue) *Query
Params To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. API name: params
func (Query) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Query) 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 (*Query) Query ¶
Query The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. API name: query
type Request ¶
type Request struct { // Columnar By default, ES|QL returns results as rows. For example, FROM returns each // individual document as one row. For the JSON, YAML, CBOR and smile formats, // ES|QL can return the results in a columnar fashion where one row represents // all the values of a certain column in the results. Columnar *bool `json:"columnar,omitempty"` // Filter Specify a Query DSL query in the filter parameter to filter the set of // documents that an ES|QL query runs on. Filter *types.Query `json:"filter,omitempty"` Locale *string `json:"locale,omitempty"` // Params To avoid any attempts of hacking or code injection, extract the values in a // separate list of parameters. Use question mark placeholders (?) in the query // string for each of the parameters. Params []types.ScalarValue `json:"params,omitempty"` // Query The ES|QL query API accepts an ES|QL query string in the query parameter, // runs it, and returns the results. Query string `json:"query"` }
Request holds the request body struct for the package query