# README
esextensions
import "github.com/greenbone/opensight-golang-libraries/pkg/openSearch/esextension"
Package esextensions provides extensions for https://github.com/aquasecurity/esquery
Index
- type CompositeAgg
- func Composite(name string) *CompositeAgg
- func (agg *CompositeAgg) After(after map[string]string) *CompositeAgg
- func (agg *CompositeAgg) Aggregations(aggregations ...esquery.Aggregation) *CompositeAgg
- func (agg *CompositeAgg) Map() map[string]interface{}
- func (agg *CompositeAgg) Name() string
- func (agg *CompositeAgg) Size(size uint64) *CompositeAgg
- func (agg *CompositeAgg) Sources(sources ...esquery.Mappable) *CompositeAgg
- type MatchQuery
- type NestedQuery
- type ScriptedSumAggregation
- type TermsSource
type CompositeAgg
CompositeAgg represents a composite aggregation, as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-aggregations-bucket-composite-aggregation.html . To be used in conjunction with the esquery library https://github.com/aquasecurity/esquery
type CompositeAgg struct {
// contains filtered or unexported fields
}
func Composite
func Composite(name string) *CompositeAgg
Composite creates an aggregation of type "composite".
func (*CompositeAgg) After
func (agg *CompositeAgg) After(after map[string]string) *CompositeAgg
After sets the identification for the entry after which the next results should be returned.
func (*CompositeAgg) Aggregations
func (agg *CompositeAgg) Aggregations(aggregations ...esquery.Aggregation) *CompositeAgg
Aggregations sets the aggregations to be used for the buckets.
func (*CompositeAgg) Map
func (agg *CompositeAgg) Map() map[string]interface{}
Map returns a map representation of the CompositeAgg, thus implementing the esquery.Mappable interface. Used for serialization to JSON.
func (*CompositeAgg) Name
func (agg *CompositeAgg) Name() string
Name returns the name of the aggregation, needed for the esquery.Aggregation interface.
func (*CompositeAgg) Size
func (agg *CompositeAgg) Size(size uint64) *CompositeAgg
Size sets the maximum number of buckets to return.
func (*CompositeAgg) Sources
func (agg *CompositeAgg) Sources(sources ...esquery.Mappable) *CompositeAgg
Sources sets the sources for the buckets.
type MatchQuery
MatchQuery represents an OpenSearch match part in an OpenSearch query as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-filter-context.html#query-filter-context-ex
type MatchQuery struct {
Field string
Value interface{}
}
func Match
func Match(field string, value interface{}) *MatchQuery
Match creates a new MatchQuery.
func (*MatchQuery) Map
func (mq *MatchQuery) Map() map[string]interface{}
Map returns a map representation of the MatchQuery, thus implementing the esquery.Mappable interface. Used for serialization to JSON.
type NestedQuery
NestedQuery represents an OpenSearch nested query.
type NestedQuery struct {
Path string `json:"path"`
Query esquery.BoolQuery `json:"query"`
}
func Nested
func Nested(field string, q esquery.BoolQuery) *NestedQuery
Nested creates a new NestedQuery.
func (*NestedQuery) Map
func (nq *NestedQuery) Map() map[string]interface{}
Map returns a map representation of the NestedQuery, thus implementing the esquery.Mappable interface. Used for serialization to JSON.
type ScriptedSumAggregation
ScriptedSumAggregation represents an aggregation that calculates the sum using a scripted expression. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-aggregations-metrics-sum-aggregation.html#_script_14 . To be used in conjunction with the esquery library https://github.com/aquasecurity/esquery
type ScriptedSumAggregation struct {
// contains filtered or unexported fields
}
func ScriptedSumAgg
func ScriptedSumAgg(name string, script string) *ScriptedSumAggregation
ScriptedSumAgg is a function that creates a new instance of ScriptedSumAggregation. It takes the name and script as parameters and returns a pointer to the ScriptedSumAggregation struct. Example usage:
a := ScriptedSumAgg("testName", "testScript")
func (*ScriptedSumAggregation) Map
func (a *ScriptedSumAggregation) Map() map[string]interface{}
Map returns a map representation of the ScriptedSumAggregation, thus implementing the esquery.Mappable interface. Used for serialization to JSON.
func (*ScriptedSumAggregation) Name
func (a *ScriptedSumAggregation) Name() string
Name returns the name of the ScriptedSumAggregation, needed for the esquery.Aggregation interface.
type TermsSource
TermsSource represents a terms value source to composite aggregations, as described in https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-aggregations-bucket-composite-aggregation.html#_terms see also CompositeAgg
type TermsSource struct {
// contains filtered or unexported fields
}
func Terms
func Terms(name string, field string) *TermsSource
Terms creates a new TermsSource. Is tested in compositeAgg_test.go.
name: The name of the terms TermsSource. field: The name of the field referenced.
func (*TermsSource) Map
func (t *TermsSource) Map() map[string]interface{}
Map returns a map representation of the TermsSource, thus implementing the esquery.Mappable interface. Used for serialization to JSON. Is tested in compositeAgg_test.go.
Generated by gomarkdoc
License
Copyright (C) 2022-2023 [Greenbone AG][Greenbone AG]
Licensed under the GNU General Public License v3.0 or later.