termsenum

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: 12 Imported by: 3

Documentation

Overview

The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios.

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 NewTermsEnum

type NewTermsEnum func(index string) *TermsEnum

NewTermsEnum type alias for index.

func NewTermsEnumFunc

func NewTermsEnumFunc(tp elastictransport.Interface) NewTermsEnum

NewTermsEnumFunc returns a new instance of TermsEnum 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 {

	// CaseInsensitive When true the provided search string is matched against index terms without
	// case sensitivity.
	CaseInsensitive *bool `json:"case_insensitive,omitempty"`
	// Field The string to match at the start of indexed terms. If not provided, all terms
	// in the field are considered.
	Field string `json:"field"`
	// IndexFilter Allows to filter an index shard if the provided query rewrites to match_none.
	IndexFilter *types.Query `json:"index_filter,omitempty"`
	SearchAfter *string      `json:"search_after,omitempty"`
	// Size How many matching terms to return.
	Size *int `json:"size,omitempty"`
	// String The string after which terms in the index should be returned. Allows for a
	// form of pagination if the last result from one request is passed as the
	// search_after parameter for a subsequent request.
	String *string `json:"string,omitempty"`
	// Timeout The maximum length of time to spend collecting results. Defaults to "1s" (one
	// second). If the timeout is exceeded the complete flag set to false in the
	// response and the results may be partial or empty.
	Timeout types.Duration `json:"timeout,omitempty"`
}

Request holds the request body struct for the package termsenum

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/terms_enum/TermsEnumRequest.ts#L26-L65

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

func (*Request) UnmarshalJSON added in v8.12.1

func (s *Request) UnmarshalJSON(data []byte) error

type Response added in v8.7.0

type Response struct {
	Complete bool                  `json:"complete"`
	Shards_  types.ShardStatistics `json:"_shards"`
	Terms    []string              `json:"terms"`
}

Response holds the response body struct for the package termsenum

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/terms_enum/TermsEnumResponse.ts#L22-L28

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

type TermsEnum

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

func New

The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios.

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

func (*TermsEnum) CaseInsensitive added in v8.9.0

func (r *TermsEnum) CaseInsensitive(caseinsensitive bool) *TermsEnum

CaseInsensitive When true the provided search string is matched against index terms without case sensitivity. API name: case_insensitive

func (TermsEnum) Do

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

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

func (*TermsEnum) Field added in v8.9.0

func (r *TermsEnum) Field(field string) *TermsEnum

Field The string to match at the start of indexed terms. If not provided, all terms in the field are considered. API name: field

func (*TermsEnum) Header

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

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

func (*TermsEnum) HttpRequest

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

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

func (*TermsEnum) IndexFilter added in v8.9.0

func (r *TermsEnum) IndexFilter(indexfilter *types.Query) *TermsEnum

IndexFilter Allows to filter an index shard if the provided query rewrites to match_none. API name: index_filter

func (TermsEnum) Perform added in v8.7.0

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

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

func (*TermsEnum) Raw

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

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

func (*TermsEnum) Request

func (r *TermsEnum) Request(req *Request) *TermsEnum

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

func (*TermsEnum) SearchAfter added in v8.9.0

func (r *TermsEnum) SearchAfter(searchafter string) *TermsEnum

API name: search_after

func (*TermsEnum) Size added in v8.9.0

func (r *TermsEnum) Size(size int) *TermsEnum

Size How many matching terms to return. API name: size

func (*TermsEnum) String added in v8.9.0

func (r *TermsEnum) String(string string) *TermsEnum

String The string after which terms in the index should be returned. Allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request. API name: string

func (*TermsEnum) Timeout added in v8.9.0

func (r *TermsEnum) Timeout(duration types.Duration) *TermsEnum

Timeout The maximum length of time to spend collecting results. Defaults to "1s" (one second). If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty. API name: timeout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL