termvectors

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 and statistics about terms in the fields of a particular document.

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 NewTermvectors

type NewTermvectors func(index string) *Termvectors

NewTermvectors type alias for index.

func NewTermvectorsFunc

func NewTermvectorsFunc(tp elastictransport.Interface) NewTermvectors

NewTermvectorsFunc returns a new instance of Termvectors 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 {

	// Doc An artificial document (a document not present in the index) for which you
	// want to retrieve term vectors.
	Doc json.RawMessage `json:"doc,omitempty"`
	// Filter Filter terms based on their tf-idf scores.
	Filter *types.TermVectorsFilter `json:"filter,omitempty"`
	// PerFieldAnalyzer Overrides the default per-field analyzer.
	PerFieldAnalyzer map[string]string `json:"per_field_analyzer,omitempty"`
}

Request holds the request body struct for the package termvectors

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/termvectors/TermVectorsRequest.ts#L33-L118

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 {
	Found       bool                        `json:"found"`
	Id_         string                      `json:"_id"`
	Index_      string                      `json:"_index"`
	TermVectors map[string]types.TermVector `json:"term_vectors,omitempty"`
	Took        int64                       `json:"took"`
	Version_    int64                       `json:"_version"`
}

Response holds the response body struct for the package termvectors

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/termvectors/TermVectorsResponse.ts#L25-L34

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

type Termvectors

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

func New

Returns information and statistics about terms in the fields of a particular document.

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

func (Termvectors) Do

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

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

func (*Termvectors) Doc added in v8.9.0

func (r *Termvectors) Doc(doc interface{}) *Termvectors

Doc An artificial document (a document not present in the index) for which you want to retrieve term vectors. API name: doc

doc should be a json.RawMessage or a structure if a structure is provided, the client will defer a json serialization prior to sending the payload to Elasticsearch.

func (*Termvectors) FieldStatistics

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

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

func (*Termvectors) Fields

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

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

func (*Termvectors) Filter added in v8.9.0

func (r *Termvectors) Filter(filter *types.TermVectorsFilter) *Termvectors

Filter Filter terms based on their tf-idf scores. API name: filter

func (*Termvectors) Header

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

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

func (*Termvectors) HttpRequest

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

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

func (*Termvectors) Id

func (r *Termvectors) Id(id string) *Termvectors

Id Unique identifier of the document. API Name: id

func (*Termvectors) Offsets

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

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

func (*Termvectors) Payloads

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

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

func (*Termvectors) PerFieldAnalyzer added in v8.9.0

func (r *Termvectors) PerFieldAnalyzer(perfieldanalyzer map[string]string) *Termvectors

PerFieldAnalyzer Overrides the default per-field analyzer. API name: per_field_analyzer

func (Termvectors) Perform added in v8.7.0

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

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

func (*Termvectors) Positions

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

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

func (*Termvectors) Preference

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

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

func (*Termvectors) Raw

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

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

func (*Termvectors) Realtime

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

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

func (*Termvectors) Request

func (r *Termvectors) Request(req *Request) *Termvectors

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

func (*Termvectors) Routing

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

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

func (*Termvectors) TermStatistics

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

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

func (*Termvectors) Version

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

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

func (*Termvectors) VersionType

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

VersionType Specific version type. API name: version_type

Jump to

Keyboard shortcuts

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