aggs

package
v0.0.0-...-dcf8ddf Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvgAgg

type AvgAgg struct {
	*BaseAgg `structs:",flatten"`
}

AvgAgg represents an aggregation of type "avg", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-avg-aggregation.html

func Avg

func Avg(name, field string) *AvgAgg

Avg creates an aggregation of type "avg", with the provided name and on the provided field.

func (*AvgAgg) Missing

func (agg *AvgAgg) Missing(val interface{}) *AvgAgg

Missing sets the value to provide for documents missing a value for the selected field.

type BaseAgg

type BaseAgg struct {
	*BaseAggParams `structs:",flatten"`
	// contains filtered or unexported fields
}

BaseAgg contains several fields that are common for all aggregation types.

func (*BaseAgg) Map

func (agg *BaseAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, implementing the Mappable interface.

func (*BaseAgg) Name

func (agg *BaseAgg) Name() string

Name returns the name of the aggregation, allowing implementation of the Aggregation interface.

type BaseAggParams

type BaseAggParams struct {
	// Field is the name of the field to aggregate on.
	Field string `structs:"field"`
	// Miss is a value to provide for documents that are missing a value for the
	// field.
	Miss interface{} `structs:"missing,omitempty"`
}

BaseAggParams contains fields that are common to most metric-aggregation types.

type CardinalityAgg

type CardinalityAgg struct {
	*BaseAgg `structs:",flatten"`

	// PrecisionThr is the precision threshold of the aggregation
	PrecisionThr uint16 `structs:"precision_threshold,omitempty"`
}

CardinalityAgg represents an aggregation of type "cardinality", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-cardinality-aggregation.html

func Cardinality

func Cardinality(name, field string) *CardinalityAgg

Cardinality creates a new aggregation of type "cardinality" with the provided name and on the provided field.

func (*CardinalityAgg) Map

func (agg *CardinalityAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface

func (*CardinalityAgg) Missing

func (agg *CardinalityAgg) Missing(val interface{}) *CardinalityAgg

Missing sets the value to provide for records that are missing a value for the field.

func (*CardinalityAgg) PrecisionThreshold

func (agg *CardinalityAgg) PrecisionThreshold(val uint16) *CardinalityAgg

PrecisionThreshold sets the precision threshold of the aggregation.

type FilterAggregation

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

func FilterAgg

func FilterAgg(name string, filter common.Mappable) *FilterAggregation

FilterAgg creates a new common.Aggregation of type "filter". The method name includes the "Agg" suffix to prevent conflict with the "filter" query.

func (*FilterAggregation) Aggs

Aggs sets sub-common.Aggregations for the common.Aggregation.

func (*FilterAggregation) Filter

func (agg *FilterAggregation) Filter(filter common.Mappable) *FilterAggregation

Filter sets the filter items

func (*FilterAggregation) Map

func (agg *FilterAggregation) Map() map[string]interface{}

func (*FilterAggregation) Name

func (agg *FilterAggregation) Name() string

Name returns the name of the common.Aggregation.

type MaxAgg

type MaxAgg struct {
	*BaseAgg `structs:",flatten"`
}

MaxAgg represents an aggregation of type "max", as described in: https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-max-aggregation.html

func Max

func Max(name, field string) *MaxAgg

Max creates a new aggregation of type "max", with the provided name and on the provided field.

func (*MaxAgg) Missing

func (agg *MaxAgg) Missing(val interface{}) *MaxAgg

Missing sets the value to provide for records that are missing a value for the field.

type MinAgg

type MinAgg struct {
	*BaseAgg `structs:",flatten"`
}

MinAgg represents an aggregation of type "min", as described in: https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-min-aggregation.html

func Min

func Min(name, field string) *MinAgg

Min creates a new aggregation of type "min", with the provided name and on the provided field.

func (*MinAgg) Missing

func (agg *MinAgg) Missing(val interface{}) *MinAgg

Missing sets the value to provide for records that are missing a value for the field.

type NestedAggregation

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

func NestedAgg

func NestedAgg(name string, path string) *NestedAggregation

NestedAgg creates a new aggregation of type "nested". The method name includes the "Agg" suffix to prevent conflict with the "nested" query.

func (*NestedAggregation) Aggs

Aggs sets sub-aggregations for the aggregation.

func (*NestedAggregation) Map

func (agg *NestedAggregation) Map() map[string]interface{}

func (*NestedAggregation) Name

func (agg *NestedAggregation) Name() string

Name returns the name of the aggregation.

func (*NestedAggregation) Path

Path NumberOfFragments sets the aggregations path

type PercentilesAgg

type PercentilesAgg struct {
	*BaseAgg `structs:",flatten"`

	// Prcnts is the aggregation's percentages
	Prcnts []float32 `structs:"percents,omitempty"`

	// Key denotes whether the aggregation is keyed or not
	Key *bool `structs:"keyed,omitempty"`

	// TDigest includes options for the TDigest algorithm
	TDigest struct {
		// Compression is the compression level to use
		Compression uint16 `structs:"compression,omitempty"`
	} `structs:"tdigest,omitempty"`

	// HDR includes options for the HDR implementation
	HDR struct {
		// NumHistogramDigits defines the resolution of values for the histogram
		// in number of significant digits
		NumHistogramDigits uint8 `structs:"number_of_significant_value_digits,omitempty"`
	} `structs:"hdr,omitempty"`
}

PercentilesAgg represents an aggregation of type "percentiles", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-percentile-aggregation.html

func Percentiles

func Percentiles(name, field string) *PercentilesAgg

Percentiles creates a new aggregation of type "percentiles" with the provided name and on the provided field.

func (*PercentilesAgg) Compression

func (agg *PercentilesAgg) Compression(val uint16) *PercentilesAgg

Compression sets the compression level for the aggregation.

func (*PercentilesAgg) Keyed

func (agg *PercentilesAgg) Keyed(b bool) *PercentilesAgg

Keyed sets whether the aggregate is keyed or not.

func (*PercentilesAgg) Map

func (agg *PercentilesAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface.

func (*PercentilesAgg) Missing

func (agg *PercentilesAgg) Missing(val interface{}) *PercentilesAgg

Missing sets the value to provide for records that are missing a value for the field.

func (*PercentilesAgg) NumHistogramDigits

func (agg *PercentilesAgg) NumHistogramDigits(val uint8) *PercentilesAgg

NumHistogramDigits specifies the resolution of values for the histogram in number of significant digits.

func (*PercentilesAgg) Percents

func (agg *PercentilesAgg) Percents(percents ...float32) *PercentilesAgg

Percents sets the aggregation's percentages

type StatsAgg

type StatsAgg struct {
	*BaseAgg `structs:",flatten"`
}

StatsAgg represents an aggregation of type "stats", as described in: https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-stats-aggregation.html

func Stats

func Stats(name, field string) *StatsAgg

Stats creates a new "stats" aggregation with the provided name and on the provided field.

func (*StatsAgg) Missing

func (agg *StatsAgg) Missing(val interface{}) *StatsAgg

Missing sets the value to provide for records missing a value for the field.

type StringStatsAgg

type StringStatsAgg struct {
	*BaseAgg `structs:",flatten"`

	// ShowDist indicates whether to ask ElasticSearch to return a probability
	// distribution for all characters
	ShowDist *bool `structs:"show_distribution,omitempty"`
}

StringStatsAgg represents an aggregation of type "string_stats", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-string-stats-aggregation.html

func StringStats

func StringStats(name, field string) *StringStatsAgg

StringStats creates a new "string_stats" aggregation with the provided name and on the provided field.

func (*StringStatsAgg) Map

func (agg *StringStatsAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface.

func (*StringStatsAgg) Missing

func (agg *StringStatsAgg) Missing(val interface{}) *StringStatsAgg

Missing sets the value to provide for records missing a value for the field.

func (*StringStatsAgg) ShowDistribution

func (agg *StringStatsAgg) ShowDistribution(b bool) *StringStatsAgg

ShowDistribution sets whether to show the probability distribution for all characters

type SumAgg

type SumAgg struct {
	*BaseAgg `structs:",flatten"`
}

SumAgg represents an aggregation of type "sum", as described in: https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-sum-aggregation.html

func Sum

func Sum(name, field string) *SumAgg

Sum creates a new aggregation of type "sum", with the provided name and on the provided field.

func (*SumAgg) Missing

func (agg *SumAgg) Missing(val interface{}) *SumAgg

Missing sets the value to provide for records that are missing a value for the field.

type TermsAggregation

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

TermsAggregation represents an aggregation of type "terms", as described in https://www.elastic.co/guide/en/elasticsearch/reference/current/

search-aggregations-bucket-terms-aggregation.html

func TermsAgg

func TermsAgg(name, field string) *TermsAggregation

TermsAgg creates a new aggregation of type "terms". The method name includes the "Agg" suffix to prevent conflict with the "terms" query.

func (*TermsAggregation) Aggs

Aggs sets sub-aggregations for the aggregation.

func (*TermsAggregation) Include

func (agg *TermsAggregation) Include(include ...string) *TermsAggregation

Include filter the values for buckets

func (*TermsAggregation) Map

func (agg *TermsAggregation) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface.

func (*TermsAggregation) Name

func (agg *TermsAggregation) Name() string

Name returns the name of the aggregation.

func (*TermsAggregation) Order

func (agg *TermsAggregation) Order(order map[string]string) *TermsAggregation

Order sets the sort for terms agg

func (*TermsAggregation) ShardSize

func (agg *TermsAggregation) ShardSize(size float64) *TermsAggregation

ShardSize sets how many terms to request from each shard.

func (*TermsAggregation) ShowTermDocCountError

func (agg *TermsAggregation) ShowTermDocCountError(b bool) *TermsAggregation

ShowTermDocCountError sets whether to show an error value for each term returned by the aggregation which represents the worst case error in the document count.

func (*TermsAggregation) Size

func (agg *TermsAggregation) Size(size uint64) *TermsAggregation

Size sets the number of term buckets to return.

type TopHitsAgg

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

TopHitsAgg represents an aggregation of type "top_hits", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-top-hits-aggregation.html

func TopHits

func TopHits(name string) *TopHitsAgg

TopHits creates an aggregation of type "top_hits".

func (*TopHitsAgg) From

func (agg *TopHitsAgg) From(offset uint64) *TopHitsAgg

From sets an offset from the first result to return.

func (*TopHitsAgg) Map

func (agg *TopHitsAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface.

func (*TopHitsAgg) Name

func (agg *TopHitsAgg) Name() string

Name returns the name of the aggregation.

func (*TopHitsAgg) Size

func (agg *TopHitsAgg) Size(size uint64) *TopHitsAgg

Size sets the maximum number of top matching hits to return per bucket (the default is 3).

func (*TopHitsAgg) Sort

func (agg *TopHitsAgg) Sort(name string, order Order) *TopHitsAgg

Sort sets how the top matching hits should be sorted. By default the hits are sorted by the score of the main query.

func (*TopHitsAgg) SourceIncludes

func (agg *TopHitsAgg) SourceIncludes(keys ...string) *TopHitsAgg

SourceIncludes sets the keys to return from the top matching documents.

type ValueCountAgg

type ValueCountAgg struct {
	*BaseAgg `structs:",flatten"`
}

ValueCountAgg represents an aggregation of type "value_count", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-valuecount-aggregation.html

func ValueCount

func ValueCount(name, field string) *ValueCountAgg

ValueCount creates a new aggregation of type "value_count", with the provided name and on the provided field

type WeightedAvgAgg

type WeightedAvgAgg struct {

	// Val is the value component of the aggregation
	Val *BaseAggParams `structs:"value"`

	// Weig is the weight component of the aggregation
	Weig *BaseAggParams `structs:"weight"`
	// contains filtered or unexported fields
}

WeightedAvgAgg represents an aggregation of type "weighted_avg", as described in https://www.elastic.co/guide/en/elasticsearch/reference/

current/search-aggregations-metrics-weight-avg-aggregation.html

func WeightedAvg

func WeightedAvg(name string) *WeightedAvgAgg

WeightedAvg creates a new aggregation of type "weighted_agg" with the provided name.

func (*WeightedAvgAgg) Map

func (agg *WeightedAvgAgg) Map() map[string]interface{}

Map returns a map representation of the aggregation, thus implementing the Mappable interface.

func (*WeightedAvgAgg) Name

func (agg *WeightedAvgAgg) Name() string

Name returns the name of the aggregation.

func (*WeightedAvgAgg) Value

func (agg *WeightedAvgAgg) Value(field string, missing ...interface{}) *WeightedAvgAgg

Value sets the value field and optionally a value to use when records are missing a value for the field.

func (*WeightedAvgAgg) Weight

func (agg *WeightedAvgAgg) Weight(field string, missing ...interface{}) *WeightedAvgAgg

Value sets the weight field and optionally a value to use when records are missing a value for the field.

Jump to

Keyboard shortcuts

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