aggregations

package
v0.99.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package aggregations contains objects and methods for processing Elasticsearch aggregations.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAggType = errors.New("invalid aggregation type")
)

Functions

func ExtractAggregation

func ExtractAggregation[T any](aggs map[string]types.Aggregate, name string) (T, error)

ExtractAggregation extracts the named aggregation as the requested type from the search response. If the aggregation cannot be extracted to the type, a non-nil error is returned that will contain details.

func ExtractBuckets added in v0.98.0

func ExtractBuckets[T BucketTypes](container any) ([]T, error)

ExtractBuckets extracts the bucket object from the aggregation as the given type. If the aggregation cannot be extracted to the type, a non-nil error is returned that will contain details.

Types

type Aggs

type Aggs map[string]types.Aggregations

type BucketTypes added in v0.98.0

type BucketTypes interface {
	types.StringTermsBucket | types.StringRareTermsBucket
}

BucketTypes is a type constraint for all aggregation bucket types.

Jump to

Keyboard shortcuts

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