rankeval

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

Allows to evaluate the quality of ranked search results over a set of typical search queries

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 NewRankEval

type NewRankEval func() *RankEval

NewRankEval type alias for index.

func NewRankEvalFunc

func NewRankEvalFunc(tp elastictransport.Interface) NewRankEval

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

type RankEval

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

func New

Allows to evaluate the quality of ranked search results over a set of typical search queries

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

func (*RankEval) AllowNoIndices

func (r *RankEval) AllowNoIndices(allownoindices bool) *RankEval

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. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. API name: allow_no_indices

func (RankEval) Do

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

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

func (*RankEval) ExpandWildcards

func (r *RankEval) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *RankEval

ExpandWildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. API name: expand_wildcards

func (*RankEval) Header

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

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

func (*RankEval) HttpRequest

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

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

func (*RankEval) IgnoreUnavailable

func (r *RankEval) IgnoreUnavailable(ignoreunavailable bool) *RankEval

IgnoreUnavailable If `true`, missing or closed indices are not included in the response. API name: ignore_unavailable

func (*RankEval) Index

func (r *RankEval) Index(index string) *RankEval

Index Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. API Name: index

func (*RankEval) Metric added in v8.9.0

func (r *RankEval) Metric(metric *types.RankEvalMetric) *RankEval

Metric Definition of the evaluation metric to calculate. API name: metric

func (RankEval) Perform added in v8.7.0

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

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

func (*RankEval) Raw

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

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

func (*RankEval) Request

func (r *RankEval) Request(req *Request) *RankEval

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

func (*RankEval) Requests added in v8.9.0

func (r *RankEval) Requests(requests ...types.RankEvalRequestItem) *RankEval

Requests A set of typical search requests, together with their provided ratings. API name: requests

func (*RankEval) SearchType

func (r *RankEval) SearchType(searchtype string) *RankEval

SearchType Search operation type API name: search_type

type Request

type Request struct {

	// Metric Definition of the evaluation metric to calculate.
	Metric *types.RankEvalMetric `json:"metric,omitempty"`
	// Requests A set of typical search requests, together with their provided ratings.
	Requests []types.RankEvalRequestItem `json:"requests"`
}

Request holds the request body struct for the package rankeval

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/rank_eval/RankEvalRequest.ts#L24-L61

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 {

	// Details The details section contains one entry for every query in the original
	// requests section, keyed by the search request id
	Details  map[string]types.RankEvalMetricDetail `json:"details"`
	Failures map[string]json.RawMessage            `json:"failures"`
	// MetricScore The overall evaluation quality calculated by the defined metric
	MetricScore types.Float64 `json:"metric_score"`
}

Response holds the response body struct for the package rankeval

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/rank_eval/RankEvalResponse.ts#L26-L34

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