explain

package
v8.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Returns information about why a specific matches (or doesn't match) a query.

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 Explain

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

func New

Returns information about why a specific matches (or doesn't match) a query.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html

func (*Explain) AnalyzeWildcard

func (r *Explain) AnalyzeWildcard(analyzewildcard bool) *Explain

AnalyzeWildcard If `true`, wildcard and prefix queries are analyzed. API name: analyze_wildcard

func (*Explain) Analyzer

func (r *Explain) Analyzer(analyzer string) *Explain

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 (*Explain) DefaultOperator

func (r *Explain) DefaultOperator(defaultoperator operator.Operator) *Explain

DefaultOperator The default operator for query string query: `AND` or `OR`. API name: default_operator

func (*Explain) Df

func (r *Explain) Df(df string) *Explain

Df Field to use as default where no field prefix is given in the query string. API name: df

func (Explain) Do

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

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

func (*Explain) Header

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

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

func (*Explain) HttpRequest

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

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

func (*Explain) Lenient

func (r *Explain) Lenient(lenient bool) *Explain

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 (Explain) Perform added in v8.7.0

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

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

func (*Explain) Preference

func (r *Explain) Preference(preference string) *Explain

Preference Specifies the node or shard the operation should be performed on. Random by default. API name: preference

func (*Explain) Q

func (r *Explain) Q(q string) *Explain

Q Query in the Lucene query string syntax. API name: q

func (*Explain) Query added in v8.9.0

func (r *Explain) Query(query *types.Query) *Explain

Query Defines the search definition using the Query DSL. API name: query

func (*Explain) Raw

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

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

func (*Explain) Request

func (r *Explain) Request(req *Request) *Explain

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

func (*Explain) Routing

func (r *Explain) Routing(routing string) *Explain

Routing Custom value used to route operations to a specific shard. API name: routing

func (*Explain) SourceExcludes_

func (r *Explain) SourceExcludes_(fields ...string) *Explain

SourceExcludes_ A comma-separated list of source fields to exclude from the response. API name: _source_excludes

func (*Explain) SourceIncludes_

func (r *Explain) SourceIncludes_(fields ...string) *Explain

SourceIncludes_ A comma-separated list of source fields to include in the response. API name: _source_includes

func (*Explain) Source_

func (r *Explain) Source_(sourceconfigparam string) *Explain

Source_ True or false to return the `_source` field or not, or a list of fields to return. API name: _source

func (*Explain) StoredFields

func (r *Explain) StoredFields(fields ...string) *Explain

StoredFields A comma-separated list of stored fields to return in the response. API name: stored_fields

type NewExplain

type NewExplain func(index, id string) *Explain

NewExplain type alias for index.

func NewExplainFunc

func NewExplainFunc(tp elastictransport.Interface) NewExplain

NewExplainFunc returns a new instance of Explain 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 Defines the search definition using the Query DSL.
	Query *types.Query `json:"query,omitempty"`
}

Request holds the request body struct for the package explain

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/explain/ExplainRequest.ts#L26-L105

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

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

FromJSON allows to load an arbitrary json into the request structure

type Response added in v8.7.0

type Response struct {
	Explanation *types.ExplanationDetail `json:"explanation,omitempty"`
	Get         *types.InlineGet         `json:"get,omitempty"`
	Id_         string                   `json:"_id"`
	Index_      string                   `json:"_index"`
	Matched     bool                     `json:"matched"`
}

Response holds the response body struct for the package explain

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/explain/ExplainResponse.ts#L23-L31

func NewResponse added in v8.7.0

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