Documentation ¶
Index ¶
- func BuildEsSearch(esExec *elasticsearchv6.EsExecutor, esSearch *EsSearch) (*elastic.SearchService, error)
- func BuildEsSearchFromSource(esExec *elasticsearchv6.EsExecutor, esSearch *EsSearch) (*elastic.SearchService, error)
- func ContextualizeDatePlaceholders(query string, t time.Time) string
- func ContextualizePlaceholders(query string, placeholders map[string]string) string
- func ContextualizeTimeZonePlaceholders(query string, t time.Time) string
- type Aggregation
- type AvgAgg
- type BoolQuery
- type Calendar
- type CardinalityAgg
- type DateHistogramAgg
- type EsQuery
- type EsSearch
- type ExistsQuery
- type FieldSort
- type FilterAgg
- type HistogramAgg
- type MaxAgg
- type MinAgg
- type Query
- type QuerySourceJSON
- type RangeQuery
- type ScriptQuery
- type SortByDoc
- type SourceAgg
- type SumAgg
- type TermAgg
- type TermQuery
- type Threshold
- type ThresholdContent
- type Thresholds
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildEsSearch ¶
func BuildEsSearch(esExec *elasticsearchv6.EsExecutor, esSearch *EsSearch) (*elastic.SearchService, error)
BuildEsSearch builds a backend elasticsearchv6 query definition
func BuildEsSearchFromSource ¶
func BuildEsSearchFromSource(esExec *elasticsearchv6.EsExecutor, esSearch *EsSearch) (*elastic.SearchService, error)
BuildEsSearchFromSource builds a backend elasticsearchv6 query definition for advanced source fact definition
func ContextualizeDatePlaceholders ¶
ContextualizeDatePlaceholders contextualize a query with the standard date placeholders (now, begin, timezone) @Deprecated
func ContextualizePlaceholders ¶
ContextualizePlaceholders contextualize a query with an ensemble of placeholders (__placeholder__) @Deprecated
Types ¶
type Aggregation ¶
type Aggregation interface { GetName() string AggSource() elastic.Aggregation }
Aggregation is an interface for every type of elasticsearch aggregation
type AvgAgg ¶
type AvgAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Script bool `json:"script"` }
AvgAgg represent an average aggregation definition
func (*AvgAgg) AggSource ¶
func (agg *AvgAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
type BoolQuery ¶
type BoolQuery struct { Type string `json:"type"` Filter []Query `json:"filter,omitempty"` Must []Query `json:"must,omitempty"` Should []Query `json:"should,omitempty"` MustNot []Query `json:"mustNot,omitempty"` }
BoolQuery represents an elasticsearch bool query clause
func (*BoolQuery) Contextualize ¶
Contextualize contextualize the current query filter with key-value system
func (*BoolQuery) UnmarshalJSON ¶
UnmarshalJSON unmarshal a bool query interface content
type Calendar ¶
type Calendar struct { Scope string `json:"scope"` Thresholds []Thresholds `json:"thresholds"` }
Calendar constains the thresholds for a scope
type CardinalityAgg ¶
type CardinalityAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Script bool `json:"script"` }
CardinalityAgg represent a cardinality aggregation definition
func (*CardinalityAgg) AggSource ¶
func (agg *CardinalityAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
func (*CardinalityAgg) GetName ¶
func (agg *CardinalityAgg) GetName() string
GetName returns the agg name
type DateHistogramAgg ¶
type DateHistogramAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Interval string `json:"interval"` SubAggs []Aggregation `json:"aggs"` TimeZone string `json:"timezone,omitempty"` }
DateHistogramAgg represent a datehistogram aggregation definition
func (*DateHistogramAgg) AggSource ¶
func (agg *DateHistogramAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
func (*DateHistogramAgg) GetName ¶
func (agg *DateHistogramAgg) GetName() string
GetName returns the agg name
func (*DateHistogramAgg) UnmarshalJSON ¶
func (agg *DateHistogramAgg) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshal a json byte slice in a DateHistogramAgg
type EsQuery ¶
type EsQuery struct { Alias string `json:"alias,omitempty"` Evaluation *Calendar `json:"evaluation,omitempty"` ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Search *EsSearch `json:"search"` }
EsQuery is related directly to one KPI
type EsSearch ¶
type EsSearch struct { Indices []string `json:"indices"` Size int `json:"size"` Offset int `json:"offset"` Order bool `json:"order"` Query Query `json:"query,omitempty"` Aggs []Aggregation `json:"aggs,omitempty"` Source string `json:"source,omitempty"` }
EsSearch represents a search definition
func (*EsSearch) UnmarshalJSON ¶
UnmarshalJSON unmarshal a json byte slice in an EsSearch object
type ExistsQuery ¶
ExistsQuery represents an elasticsearch exists query clause
func (*ExistsQuery) Contextualize ¶
func (q *ExistsQuery) Contextualize(key string, value string)
Contextualize contextualize the current query filter with key-value system
func (*ExistsQuery) Source ¶
func (q *ExistsQuery) Source() elastic.Query
Source convert the query to a elasticsearch query interface
type FieldSort ¶
FieldSort is a specific sorting method using a sorting field
func NewFieldSort ¶
NewFieldSort returns a new FieldSort based a on field and an order (asc, desc)
type FilterAgg ¶
type FilterAgg struct { Name string `json:"name"` SubAggs *Aggregation `json:"aggs"` Query *Query `json:"filter"` }
FilterAgg represent a filter aggregation definition
func (*FilterAgg) AggSource ¶
func (agg *FilterAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
type HistogramAgg ¶
type HistogramAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Interval float64 `json:"interval"` SubAggs []Aggregation `json:"aggs"` }
HistogramAgg represent an histogram aggregation definition
func (*HistogramAgg) AggSource ¶
func (agg *HistogramAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
func (*HistogramAgg) GetName ¶
func (agg *HistogramAgg) GetName() string
GetName returns the agg name
func (*HistogramAgg) UnmarshalJSON ¶
func (agg *HistogramAgg) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshal a json byte slice in a HistogramAgg
type MaxAgg ¶
type MaxAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Script bool `json:"script"` }
MaxAgg represent a max aggregation definition
func (*MaxAgg) AggSource ¶
func (agg *MaxAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
type MinAgg ¶
type MinAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Script bool `json:"script"` }
MinAgg represent a min aggregation definition
func (*MinAgg) AggSource ¶
func (agg *MinAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
type QuerySourceJSON ¶
type QuerySourceJSON struct { Size int `json:"size"` From int `json:"from"` Sort interface{} `json:"sort,omitempty"` Query interface{} `json:"query,omitempty"` Aggs interface{} `json:"aggs,string,omitempty"` }
QuerySourceJSON query and agg elastic syntax ready.
func BuildEsSearchSource ¶
func BuildEsSearchSource(esSearch *EsSearch) (*QuerySourceJSON, error)
BuildEsSearchSource returns a json representation of an elasticsearchv6 query clause
func NewQuerySourceJSON ¶
func NewQuerySourceJSON(query interface{}, aggs interface{}, size int, from int, sort interface{}) *QuerySourceJSON
NewQuerySourceJSON builds QuerySourceJSON.
type RangeQuery ¶
type RangeQuery struct { Type string `json:"type"` Field string `json:"field"` From interface{} `json:"from,omitempty"` IncludeFrom bool `json:"includeFrom"` To interface{} `json:"to,omitempty"` IncludeTo bool `json:"includeTo"` TimeZone string `json:"timezone,omitempty"` }
RangeQuery represents an elasticsearch range query clause
func (*RangeQuery) Contextualize ¶
func (q *RangeQuery) Contextualize(key string, value string)
Contextualize contextualize the current query filter with key-value system
func (*RangeQuery) Source ¶
func (q *RangeQuery) Source() elastic.Query
Source convert the query to a elasticsearch query interface
type ScriptQuery ¶
ScriptQuery represents an elasticsearch script query clause
func (*ScriptQuery) Contextualize ¶
func (q *ScriptQuery) Contextualize(key string, value string)
Contextualize contextualize the current query filter with key-value system
func (*ScriptQuery) Source ¶
func (q *ScriptQuery) Source() elastic.Query
Source convert the query to a elasticsearch query interface
type SourceAgg ¶
type SourceAgg struct {
Aggregation
}
SourceAgg represent a source aggregation definition
type SumAgg ¶
type SumAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Script bool `json:"script"` }
SumAgg represent a sum aggregation definition
func (*SumAgg) AggSource ¶
func (agg *SumAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
type TermAgg ¶
type TermAgg struct { Type string `json:"type"` Name string `json:"name"` Field string `json:"field"` Size int `json:"size"` SubAggs []Aggregation `json:"aggs"` }
TermAgg represent a term aggregation definition
func (*TermAgg) AggSource ¶
func (agg *TermAgg) AggSource() elastic.Aggregation
AggSource returns a standard elasticsearch aggregation
func (*TermAgg) UnmarshalJSON ¶
UnmarshalJSON unmarshal a json byte slice in a TermAgg
type TermQuery ¶
type TermQuery struct { Type string `json:"type"` Field string `json:"field"` Value interface{} `json:"value"` }
TermQuery represents an elasticsearch term query clause
func (*TermQuery) Contextualize ¶
Contextualize contextualize the current query filter with key-value system
type Threshold ¶
type Threshold struct { From string `json:"from"` To string `json:"to"` Val []ThresholdContent `json:"value"` }
Threshold type. @Deprecated
type ThresholdContent ¶
type ThresholdContent struct { ID int `json:"id,omitempty"` From interface{} `json:"from"` To interface{} `json:"to"` Name string `json:"name"` }
ThresholdContent type value.
type Thresholds ¶
Thresholds is a struct representing a KPI threshold @Deprecated