mtermvectors

package
v8.19.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Overview

Get multiple term vectors.

Get multiple term vectors with a single request. You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a `docs` array with all the fetched termvectors. Each element has the structure provided by the termvectors API.

**Artificial documents**

You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.

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 Mtermvectors

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

func New

Get multiple term vectors.

Get multiple term vectors with a single request. You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a `docs` array with all the fetched termvectors. Each element has the structure provided by the termvectors API.

**Artificial documents**

You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html

func (Mtermvectors) Do

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

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

func (*Mtermvectors) Docs added in v8.9.0

Docs An array of existing or artificial documents. API name: docs

func (*Mtermvectors) ErrorTrace added in v8.14.0

func (r *Mtermvectors) ErrorTrace(errortrace bool) *Mtermvectors

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*Mtermvectors) FieldStatistics

func (r *Mtermvectors) FieldStatistics(fieldstatistics bool) *Mtermvectors

FieldStatistics If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. API name: field_statistics

func (*Mtermvectors) Fields

func (r *Mtermvectors) Fields(fields ...string) *Mtermvectors

Fields A comma-separated list or wildcard expressions of fields to include in the statistics. It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters. API name: fields

func (*Mtermvectors) FilterPath added in v8.14.0

func (r *Mtermvectors) FilterPath(filterpaths ...string) *Mtermvectors

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*Mtermvectors) Header

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

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

func (*Mtermvectors) HttpRequest

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

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

func (*Mtermvectors) Human added in v8.14.0

func (r *Mtermvectors) Human(human bool) *Mtermvectors

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (*Mtermvectors) Ids

func (r *Mtermvectors) Ids(ids ...string) *Mtermvectors

Ids A simplified syntax to specify documents by their ID if they're in the same index. API name: ids

func (*Mtermvectors) Index

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

Index The name of the index that contains the documents. API Name: index

func (*Mtermvectors) Offsets

func (r *Mtermvectors) Offsets(offsets bool) *Mtermvectors

Offsets If `true`, the response includes term offsets. API name: offsets

func (*Mtermvectors) Payloads

func (r *Mtermvectors) Payloads(payloads bool) *Mtermvectors

Payloads If `true`, the response includes term payloads. API name: payloads

func (Mtermvectors) Perform added in v8.7.0

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

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

func (*Mtermvectors) Positions

func (r *Mtermvectors) Positions(positions bool) *Mtermvectors

Positions If `true`, the response includes term positions. API name: positions

func (*Mtermvectors) Preference

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

Preference The node or shard the operation should be performed on. It is random by default. API name: preference

func (*Mtermvectors) Pretty added in v8.14.0

func (r *Mtermvectors) Pretty(pretty bool) *Mtermvectors

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*Mtermvectors) Raw

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

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

func (*Mtermvectors) Realtime

func (r *Mtermvectors) Realtime(realtime bool) *Mtermvectors

Realtime If true, the request is real-time as opposed to near-real-time. API name: realtime

func (*Mtermvectors) Request

func (r *Mtermvectors) Request(req *Request) *Mtermvectors

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

func (*Mtermvectors) Routing

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

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

func (*Mtermvectors) TermStatistics

func (r *Mtermvectors) TermStatistics(termstatistics bool) *Mtermvectors

TermStatistics If true, the response includes term frequency and document frequency. API name: term_statistics

func (*Mtermvectors) Version

func (r *Mtermvectors) Version(versionnumber string) *Mtermvectors

Version If `true`, returns the document version as part of a hit. API name: version

func (*Mtermvectors) VersionType

func (r *Mtermvectors) VersionType(versiontype versiontype.VersionType) *Mtermvectors

VersionType The version type. API name: version_type

type NewMtermvectors

type NewMtermvectors func() *Mtermvectors

NewMtermvectors type alias for index.

func NewMtermvectorsFunc

func NewMtermvectorsFunc(tp elastictransport.Interface) NewMtermvectors

NewMtermvectorsFunc returns a new instance of Mtermvectors 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 {
	// Docs An array of existing or artificial documents.
	Docs []types.MTermVectorsOperation `json:"docs,omitempty"`
	// Ids A simplified syntax to specify documents by their ID if they're in the same
	// index.
	Ids []string `json:"ids,omitempty"`
}

Request holds the request body struct for the package mtermvectors

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/_global/mtermvectors/MultiTermVectorsRequest.ts#L31-L134

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 {
	Docs []types.TermVectorsResult `json:"docs"`
}

Response holds the response body struct for the package mtermvectors

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/_global/mtermvectors/MultiTermVectorsResponse.ts#L22-L24

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