Documentation ¶
Index ¶
- func NewStorage(url string, index string, opts ...elastic.ClientOptionFunc) (alerts.Storage, error)
- type GeoShapeQuery
- func (q *GeoShapeQuery) QueryName(queryName string) *GeoShapeQuery
- func (q *GeoShapeQuery) SetPoint(lat, lon float64) *GeoShapeQuery
- func (q *GeoShapeQuery) SetPolygon(points [][][]float64) *GeoShapeQuery
- func (q *GeoShapeQuery) SetRelation(rel string) *GeoShapeQuery
- func (q *GeoShapeQuery) Source() (interface{}, error)
- type Storage
- func (s *Storage) Add(ctx context.Context, alert *cap.Alert) error
- func (s *Storage) Find(ctx context.Context, criteria *alerts.FindCriteria) (*alerts.FindResult, error)
- func (s *Storage) Get(ctx context.Context, reference *cap.Reference) (*cap.Alert, error)
- func (s *Storage) Has(ctx context.Context, reference *cap.Reference) (bool, error)
- func (s *Storage) IsSuperseded(ctx context.Context, reference *cap.Reference) (bool, error)
- func (s *Storage) Supersede(ctx context.Context, reference *cap.Reference) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GeoShapeQuery ¶
type GeoShapeQuery struct {
// contains filtered or unexported fields
}
GeoShapeQuery allows to include hits that match a geoshape
For more details, see: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html
func NewGeoShapeQuery ¶
func NewGeoShapeQuery(name string) *GeoShapeQuery
NewGeoShapeQuery creates and initializes a new GeoShapeQuery.
func (*GeoShapeQuery) QueryName ¶
func (q *GeoShapeQuery) QueryName(queryName string) *GeoShapeQuery
func (*GeoShapeQuery) SetPoint ¶
func (q *GeoShapeQuery) SetPoint(lat, lon float64) *GeoShapeQuery
SetPoint adds a point from latitude and longitude.
func (*GeoShapeQuery) SetPolygon ¶
func (q *GeoShapeQuery) SetPolygon(points [][][]float64) *GeoShapeQuery
SetPolygon adds a polygon from a list of latitude and longitude.
func (*GeoShapeQuery) SetRelation ¶
func (q *GeoShapeQuery) SetRelation(rel string) *GeoShapeQuery
SetRelation sets the geoJSON relation for the query
func (*GeoShapeQuery) Source ¶
func (q *GeoShapeQuery) Source() (interface{}, error)
Source returns JSON for the function score query.
type Storage ¶
type Storage struct { Client *elastic.Client Index string }
Storage defines an Elasticsearch alerts storage.
func (*Storage) Find ¶
func (s *Storage) Find(ctx context.Context, criteria *alerts.FindCriteria) (*alerts.FindResult, error)
Find returns alerts matching the search criteria. NOTE: Results are per Info block.
func (*Storage) IsSuperseded ¶
IsSuperseded returns whether or not the referenced alert has been superseded.