Documentation
¶
Overview ¶
Run an async ES|QL query. Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.
The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.
Index ¶
- Variables
- type AsyncQuery
- func (r *AsyncQuery) Columnar(columnar bool) *AsyncQuery
- func (r *AsyncQuery) Delimiter(delimiter string) *AsyncQuery
- func (r AsyncQuery) Do(providedCtx context.Context) (Response, error)
- func (r *AsyncQuery) DropNullColumns(dropnullcolumns bool) *AsyncQuery
- func (r *AsyncQuery) ErrorTrace(errortrace bool) *AsyncQuery
- func (r *AsyncQuery) Filter(filter types.QueryVariant) *AsyncQuery
- func (r *AsyncQuery) FilterPath(filterpaths ...string) *AsyncQuery
- func (r *AsyncQuery) Format(format esqlformat.EsqlFormat) *AsyncQuery
- func (r *AsyncQuery) Header(key, value string) *AsyncQuery
- func (r *AsyncQuery) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *AsyncQuery) Human(human bool) *AsyncQuery
- func (r *AsyncQuery) IncludeCcsMetadata(includeccsmetadata bool) *AsyncQuery
- func (r *AsyncQuery) KeepAlive(duration string) *AsyncQuery
- func (r *AsyncQuery) KeepOnCompletion(keeponcompletion bool) *AsyncQuery
- func (r *AsyncQuery) Locale(locale string) *AsyncQuery
- func (r *AsyncQuery) Params(params ...types.FieldValueVariant) *AsyncQuery
- func (r AsyncQuery) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *AsyncQuery) Pretty(pretty bool) *AsyncQuery
- func (r *AsyncQuery) Profile(profile bool) *AsyncQuery
- func (r *AsyncQuery) Query(query string) *AsyncQuery
- func (r *AsyncQuery) Raw(raw io.Reader) *AsyncQuery
- func (r *AsyncQuery) Request(req *Request) *AsyncQuery
- func (r *AsyncQuery) Tables(tables map[string]map[string]types.TableValuesContainer) *AsyncQuery
- func (r *AsyncQuery) WaitForCompletionTimeout(duration types.DurationVariant) *AsyncQuery
- type NewAsyncQuery
- 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 ¶
This section is empty.
Types ¶
type AsyncQuery ¶
type AsyncQuery struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *AsyncQuery
Run an async ES|QL query. Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.
The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.
https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-esql-async-query
func (*AsyncQuery) Columnar ¶
func (r *AsyncQuery) Columnar(columnar bool) *AsyncQuery
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 (*AsyncQuery) Delimiter ¶
func (r *AsyncQuery) Delimiter(delimiter string) *AsyncQuery
Delimiter The character to use between values within a CSV row. It is valid only for the CSV format. API name: delimiter
func (AsyncQuery) Do ¶
func (r AsyncQuery) Do(providedCtx context.Context) (Response, error)
Do runs the request through the transport, handle the response and returns a asyncquery.Response
func (*AsyncQuery) DropNullColumns ¶
func (r *AsyncQuery) DropNullColumns(dropnullcolumns bool) *AsyncQuery
DropNullColumns Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. API name: drop_null_columns
func (*AsyncQuery) ErrorTrace ¶
func (r *AsyncQuery) ErrorTrace(errortrace bool) *AsyncQuery
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*AsyncQuery) Filter ¶
func (r *AsyncQuery) Filter(filter types.QueryVariant) *AsyncQuery
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 (*AsyncQuery) FilterPath ¶
func (r *AsyncQuery) FilterPath(filterpaths ...string) *AsyncQuery
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*AsyncQuery) Format ¶
func (r *AsyncQuery) Format(format esqlformat.EsqlFormat) *AsyncQuery
Format A short version of the Accept header, for example `json` or `yaml`. API name: format
func (*AsyncQuery) Header ¶
func (r *AsyncQuery) Header(key, value string) *AsyncQuery
Header set a key, value pair in the AsyncQuery headers map.
func (*AsyncQuery) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*AsyncQuery) Human ¶
func (r *AsyncQuery) Human(human bool) *AsyncQuery
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 (*AsyncQuery) IncludeCcsMetadata ¶
func (r *AsyncQuery) IncludeCcsMetadata(includeccsmetadata bool) *AsyncQuery
When set to `true` and performing a cross-cluster query, the response will include an extra `_clusters` object with information about the clusters that participated in the search along with info such as shards count. API name: include_ccs_metadata
func (*AsyncQuery) KeepAlive ¶
func (r *AsyncQuery) KeepAlive(duration string) *AsyncQuery
KeepAlive The period for which the query and its results are stored in the cluster. The default period is five days. When this period expires, the query and its results are deleted, even if the query is still ongoing. If the `keep_on_completion` parameter is false, Elasticsearch only stores async queries that do not complete within the period set by the `wait_for_completion_timeout` parameter, regardless of this value. API name: keep_alive
func (*AsyncQuery) KeepOnCompletion ¶
func (r *AsyncQuery) KeepOnCompletion(keeponcompletion bool) *AsyncQuery
KeepOnCompletion Indicates whether the query and its results are stored in the cluster. If false, the query and its results are stored in the cluster only if the request does not complete during the period set by the `wait_for_completion_timeout` parameter. API name: keep_on_completion
func (*AsyncQuery) Params ¶
func (r *AsyncQuery) Params(params ...types.FieldValueVariant) *AsyncQuery
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 (AsyncQuery) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*AsyncQuery) Pretty ¶
func (r *AsyncQuery) Pretty(pretty bool) *AsyncQuery
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*AsyncQuery) Profile ¶
func (r *AsyncQuery) Profile(profile bool) *AsyncQuery
If provided and `true` the response will include an extra `profile` object with information on how the query was executed. This information is for human debugging and its format can change at any time but it can give some insight into the performance of each part of the query. API name: profile
func (*AsyncQuery) Query ¶
func (r *AsyncQuery) Query(query string) *AsyncQuery
The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. API name: query
func (*AsyncQuery) Raw ¶
func (r *AsyncQuery) Raw(raw io.Reader) *AsyncQuery
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*AsyncQuery) Request ¶
func (r *AsyncQuery) Request(req *Request) *AsyncQuery
Request allows to set the request property with the appropriate payload.
func (*AsyncQuery) Tables ¶
func (r *AsyncQuery) Tables(tables map[string]map[string]types.TableValuesContainer) *AsyncQuery
Tables to use with the LOOKUP operation. The top level key is the table name and the next level key is the column name. API name: tables
func (*AsyncQuery) WaitForCompletionTimeout ¶
func (r *AsyncQuery) WaitForCompletionTimeout(duration types.DurationVariant) *AsyncQuery
The period to wait for the request to finish. By default, the request waits for 1 second for the query results. If the query completes during this period, results are returned Otherwise, a query ID is returned that can later be used to retrieve the results. API name: wait_for_completion_timeout
type NewAsyncQuery ¶
type NewAsyncQuery func() *AsyncQuery
NewAsyncQuery type alias for index.
func NewAsyncQueryFunc ¶
func NewAsyncQueryFunc(tp elastictransport.Interface) NewAsyncQuery
NewAsyncQueryFunc returns a new instance of AsyncQuery with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.
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"` // IncludeCcsMetadata When set to `true` and performing a cross-cluster query, the response will // include an extra `_clusters` // object with information about the clusters that participated in the search // along with info such as shards // count. IncludeCcsMetadata *bool `json:"include_ccs_metadata,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.FieldValue `json:"params,omitempty"` // Profile If provided and `true` the response will include an extra `profile` object // with information on how the query was executed. This information is for human // debugging // and its format can change at any time but it can give some insight into the // performance // of each part of the query. Profile *bool `json:"profile,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"` // Tables Tables to use with the LOOKUP operation. The top level key is the table // name and the next level key is the column name. Tables map[string]map[string]types.TableValuesContainer `json:"tables,omitempty"` // WaitForCompletionTimeout The period to wait for the request to finish. // By default, the request waits for 1 second for the query results. // If the query completes during this period, results are returned // Otherwise, a query ID is returned that can later be used to retrieve the // results. WaitForCompletionTimeout types.Duration `json:"wait_for_completion_timeout,omitempty"` }
Request holds the request body struct for the package asyncquery