Documentation ¶
Overview ¶
Allows a user to validate a potentially expensive query without executing it.
Index ¶
- Variables
- type NewValidateQuery
- type Request
- type Response
- type ValidateQuery
- func (r *ValidateQuery) AllShards(allshards bool) *ValidateQuery
- func (r *ValidateQuery) AllowNoIndices(allownoindices bool) *ValidateQuery
- func (r *ValidateQuery) AnalyzeWildcard(analyzewildcard bool) *ValidateQuery
- func (r *ValidateQuery) Analyzer(analyzer string) *ValidateQuery
- func (r *ValidateQuery) DefaultOperator(defaultoperator operator.Operator) *ValidateQuery
- func (r *ValidateQuery) Df(df string) *ValidateQuery
- func (r ValidateQuery) Do(providedCtx context.Context) (*Response, error)
- func (r *ValidateQuery) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *ValidateQuery
- func (r *ValidateQuery) Explain(explain bool) *ValidateQuery
- func (r *ValidateQuery) Header(key, value string) *ValidateQuery
- func (r *ValidateQuery) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *ValidateQuery) IgnoreUnavailable(ignoreunavailable bool) *ValidateQuery
- func (r *ValidateQuery) Index(index string) *ValidateQuery
- func (r *ValidateQuery) Lenient(lenient bool) *ValidateQuery
- func (r ValidateQuery) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *ValidateQuery) Q(q string) *ValidateQuery
- func (r *ValidateQuery) Query(query *types.Query) *ValidateQuery
- func (r *ValidateQuery) Raw(raw io.Reader) *ValidateQuery
- func (r *ValidateQuery) Request(req *Request) *ValidateQuery
- func (r *ValidateQuery) Rewrite(rewrite bool) *ValidateQuery
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 NewValidateQuery ¶
type NewValidateQuery func() *ValidateQuery
NewValidateQuery type alias for index.
func NewValidateQueryFunc ¶
func NewValidateQueryFunc(tp elastictransport.Interface) NewValidateQuery
NewValidateQueryFunc returns a new instance of ValidateQuery 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 { // Query Query in the Lucene query string syntax. Query *types.Query `json:"query,omitempty"` }
Request holds the request body struct for the package validatequery
type Response ¶
type Response struct { Error *string `json:"error,omitempty"` Explanations []types.IndicesValidationExplanation `json:"explanations,omitempty"` Shards_ *types.ShardStatistics `json:"_shards,omitempty"` Valid bool `json:"valid"` }
Response holds the response body struct for the package validatequery
type ValidateQuery ¶
type ValidateQuery struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *ValidateQuery
Allows a user to validate a potentially expensive query without executing it.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html
func (*ValidateQuery) AllShards ¶
func (r *ValidateQuery) AllShards(allshards bool) *ValidateQuery
AllShards If `true`, the validation is executed on all shards instead of one random shard per index. API name: all_shards
func (*ValidateQuery) AllowNoIndices ¶
func (r *ValidateQuery) AllowNoIndices(allownoindices bool) *ValidateQuery
AllowNoIndices If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. API name: allow_no_indices
func (*ValidateQuery) AnalyzeWildcard ¶
func (r *ValidateQuery) AnalyzeWildcard(analyzewildcard bool) *ValidateQuery
AnalyzeWildcard If `true`, wildcard and prefix queries are analyzed. API name: analyze_wildcard
func (*ValidateQuery) Analyzer ¶
func (r *ValidateQuery) Analyzer(analyzer string) *ValidateQuery
Analyzer Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. API name: analyzer
func (*ValidateQuery) DefaultOperator ¶
func (r *ValidateQuery) DefaultOperator(defaultoperator operator.Operator) *ValidateQuery
DefaultOperator The default operator for query string query: `AND` or `OR`. API name: default_operator
func (*ValidateQuery) Df ¶
func (r *ValidateQuery) Df(df string) *ValidateQuery
Df Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. API name: df
func (ValidateQuery) Do ¶
func (r ValidateQuery) Do(providedCtx context.Context) (*Response, error)
Do runs the request through the transport, handle the response and returns a validatequery.Response
func (*ValidateQuery) ExpandWildcards ¶
func (r *ValidateQuery) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *ValidateQuery
ExpandWildcards Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. API name: expand_wildcards
func (*ValidateQuery) Explain ¶
func (r *ValidateQuery) Explain(explain bool) *ValidateQuery
Explain If `true`, the response returns detailed information if an error has occurred. API name: explain
func (*ValidateQuery) Header ¶
func (r *ValidateQuery) Header(key, value string) *ValidateQuery
Header set a key, value pair in the ValidateQuery headers map.
func (*ValidateQuery) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*ValidateQuery) IgnoreUnavailable ¶
func (r *ValidateQuery) IgnoreUnavailable(ignoreunavailable bool) *ValidateQuery
IgnoreUnavailable If `false`, the request returns an error if it targets a missing or closed index. API name: ignore_unavailable
func (*ValidateQuery) Index ¶
func (r *ValidateQuery) Index(index string) *ValidateQuery
Index Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams or indices, omit this parameter or use `*` or `_all`. API Name: index
func (*ValidateQuery) Lenient ¶
func (r *ValidateQuery) Lenient(lenient bool) *ValidateQuery
Lenient If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. API name: lenient
func (ValidateQuery) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*ValidateQuery) Q ¶
func (r *ValidateQuery) Q(q string) *ValidateQuery
Q Query in the Lucene query string syntax. API name: q
func (*ValidateQuery) Query ¶
func (r *ValidateQuery) Query(query *types.Query) *ValidateQuery
Query Query in the Lucene query string syntax. API name: query
func (*ValidateQuery) Raw ¶
func (r *ValidateQuery) Raw(raw io.Reader) *ValidateQuery
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*ValidateQuery) Request ¶
func (r *ValidateQuery) Request(req *Request) *ValidateQuery
Request allows to set the request property with the appropriate payload.
func (*ValidateQuery) Rewrite ¶
func (r *ValidateQuery) Rewrite(rewrite bool) *ValidateQuery
Rewrite If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. API name: rewrite