Documentation
¶
Overview ¶
Package assoc implements the Elasticsearch "associated terms" features (more_like_this, suggesters, significant_terms) as pure functions over riot readers.
Index ¶
- func MoreLikeThis(ctx context.Context, readers []*riot.Reader, body map[string]interface{}, ...) (map[string]interface{}, error)
- func SignificantTerms(ctx context.Context, readers []*riot.Reader, ...) error
- func Suggest(ctx context.Context, readers []*riot.Reader, suggest map[string]interface{}, ...) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MoreLikeThis ¶
func MoreLikeThis(ctx context.Context, readers []*riot.Reader, body map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (map[string]interface{}, error)
MoreLikeThis rewrites the body of a {"more_like_this": body} query into a plain bool query of the most interesting terms of the liked texts and documents, scored by tf*idf as Lucene MoreLikeThis does. It returns {"match_none": {}} when no term qualifies.
func SignificantTerms ¶
func SignificantTerms(ctx context.Context, readers []*riot.Reader, aggs map[string]meta.AggregationResponse, req map[string]meta.Aggregations, fgCount uint64, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) error
SignificantTerms rewrites the responses of the significant_terms and significant_text aggregations of req, collected by aggregation.Request as terms aggregations, into significance buckets: the foreground counts are scored against the background frequencies of the terms in the readers (or in the documents matching background_filter). fgCount is the number of documents matched by the search; nested aggregations use the doc_count of their parent bucket as foreground size. The readers are those of the search, so a time range query narrows the background to the shards in it.
func Suggest ¶
func Suggest(ctx context.Context, readers []*riot.Reader, suggest map[string]interface{}, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (map[string]interface{}, error)
Suggest runs the "suggest" section of a search body and returns the Elasticsearch "suggest" response: {"name": [{text, offset, length, options}]}. It supports the term, phrase (simplified, see phraseSuggest) and completion suggesters.
Types ¶
This section is empty.