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 ¶
- Variables
- type NewTermsEnum
- type Request
- type Response
- type TermsEnum
- func (r *TermsEnum) CaseInsensitive(caseinsensitive bool) *TermsEnum
- func (r TermsEnum) Do(providedCtx context.Context) (*Response, error)
- func (r *TermsEnum) Field(field string) *TermsEnum
- func (r *TermsEnum) Header(key, value string) *TermsEnum
- func (r *TermsEnum) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *TermsEnum) IndexFilter(indexfilter *types.Query) *TermsEnum
- func (r TermsEnum) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *TermsEnum) Raw(raw io.Reader) *TermsEnum
- func (r *TermsEnum) Request(req *Request) *TermsEnum
- func (r *TermsEnum) SearchAfter(searchafter string) *TermsEnum
- func (r *TermsEnum) Size(size int) *TermsEnum
- func (r *TermsEnum) String(string string) *TermsEnum
- func (r *TermsEnum) Timeout(duration types.Duration) *TermsEnum
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 NewTermsEnum ¶
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
func (*Request) FromJSON ¶ added in v8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request) UnmarshalJSON ¶ added in v8.12.1
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
type TermsEnum ¶
type TermsEnum struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *TermsEnum
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
CaseInsensitive When true the provided search string is matched against index terms without case sensitivity. API name: case_insensitive
func (TermsEnum) Do ¶
Do runs the request through the transport, handle the response and returns a termsenum.Response
func (*TermsEnum) Field ¶ added in v8.9.0
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) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*TermsEnum) IndexFilter ¶ added in v8.9.0
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
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*TermsEnum) Raw ¶
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 ¶
Request allows to set the request property with the appropriate payload.
func (*TermsEnum) SearchAfter ¶ added in v8.9.0
API name: search_after
func (*TermsEnum) String ¶ added in v8.9.0
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