elasticsearch

package
v0.0.0-...-e15abb3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStorage

func NewStorage(url string, index string, opts ...elastic.ClientOptionFunc) (alerts.Storage, error)

NewStorage creates the storage.

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) Add

func (s *Storage) Add(ctx context.Context, alert *cap.Alert) error

Add adds the alert to ElasticSearch.

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) Get

func (s *Storage) Get(ctx context.Context, reference *cap.Reference) (*cap.Alert, error)

Get returns the alert described by reference from ElasticSearch.

func (*Storage) Has

func (s *Storage) Has(ctx context.Context, reference *cap.Reference) (bool, error)

Has returns whether or not an alert exists for the given reference.

func (*Storage) IsSuperseded

func (s *Storage) IsSuperseded(ctx context.Context, reference *cap.Reference) (bool, error)

IsSuperseded returns whether or not the referenced alert has been superseded.

func (*Storage) Supersede

func (s *Storage) Supersede(ctx context.Context, reference *cap.Reference) error

Supersede marks the reference as superseded.

Jump to

Keyboard shortcuts

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