Documentation ¶
Index ¶
- Constants
- Variables
- type ElasticFeedStore
- func (efs ElasticFeedStore) CancelProjectUpdateTask(ctx context.Context, projectUpdateID string, ...) error
- func (efs ElasticFeedStore) CreateFeedEntry(entry *feed.FeedEntry) (bool, error)
- func (efs ElasticFeedStore) DeleteIndex(ctx context.Context, index string) error
- func (efs ElasticFeedStore) DoesIndexExists(ctx context.Context, indexName string) (bool, error)
- func (efs ElasticFeedStore) GetActionLine(formattedFilters map[string][]string, startDate string, endDate string, ...) (*feed.ActionLine, error)
- func (efs ElasticFeedStore) GetFeed(query *feed.FeedQuery) ([]*feed.FeedEntry, int64, error)
- func (efs ElasticFeedStore) GetFeedSummary(query *feed.FeedSummaryQuery) (map[string]int64, error)
- func (efs ElasticFeedStore) InitializeStore(ctx context.Context) error
- func (efs ElasticFeedStore) JobCancel(ctx context.Context, jobID string) error
- func (efs ElasticFeedStore) JobStatus(ctx context.Context, jobID string) (project_update_lib.JobStatus, error)
- func (efs ElasticFeedStore) ListProjectUpdateTasks(ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error)
- func (efs ElasticFeedStore) MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, ...) (project_update_lib.SerializedProjectUpdateTaskStatus, error)
- func (efs ElasticFeedStore) ReindexFeedsToLatest(ctx context.Context, previousIndex string) (string, error)
- func (efs ElasticFeedStore) RunProjectUpdateTask(ctx context.Context, projectUpdateID string, params map[string]string, ...) (project_update_lib.SerializedProjectUpdateTaskID, ...)
- func (efs ElasticFeedStore) UpdateProjectTags(ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) ([]string, error)
- type FeedStore
- type Mapping
Constants ¶
const ( DefaultSortField = "pub_timestamp" PublishedTimestampField = "pub_timestamp" FeedEntryID = "entity_uuid" )
const (
IndexNameFeeds = "eventfeed-" + feedsIndicesVersion + "-feeds"
)
Variables ¶
var AllMappings = []Mapping{ Feeds, }
var Feeds = Mapping{ Index: IndexNameFeeds, Timeseries: false, Properties: fmt.Sprintf(`{ %s }`, feedProps), Mapping: fmt.Sprintf(` { "settings":{ "number_of_shards": 5, "analysis": { "analyzer": { "autocomplete": { "filter": [ "lowercase" ], "tokenizer": "autocomplete_tokenizer" } }, "tokenizer": { "autocomplete_tokenizer": { "max_gram": 20, "min_gram": 2, "token_chars": [ "letter", "digit" ], "type": "edge_ngram" } }, "normalizer": { "case_insensitive": { "type": "custom", "char_filter": [], "filter": ["lowercase", "asciifolding"] } } }, "index":{ "refresh_interval":"1s" } }, "mappings":{ %s } } `, feedProps), }
Feeds mapping used to create the feeds-[version] index
Functions ¶
This section is empty.
Types ¶
type ElasticFeedStore ¶
type ElasticFeedStore struct {
// contains filtered or unexported fields
}
func NewElasticFeedStore ¶
func NewElasticFeedStore(client *olivere.Client) *ElasticFeedStore
func (ElasticFeedStore) CancelProjectUpdateTask ¶
func (efs ElasticFeedStore) CancelProjectUpdateTask(ctx context.Context, projectUpdateID string, id project_update_lib.SerializedProjectUpdateTaskID) error
func (ElasticFeedStore) CreateFeedEntry ¶
func (efs ElasticFeedStore) CreateFeedEntry(entry *feed.FeedEntry) (bool, error)
func (ElasticFeedStore) DeleteIndex ¶
func (efs ElasticFeedStore) DeleteIndex(ctx context.Context, index string) error
DeleteIndex - delete index with name 'index'
func (ElasticFeedStore) DoesIndexExists ¶
DoesIndexExists - does the index 'indexName' exists in elasticsearch
func (ElasticFeedStore) GetActionLine ¶
func (efs ElasticFeedStore) GetActionLine(formattedFilters map[string][]string, startDate string, endDate string, timezone string, interval int, action string) (*feed.ActionLine, error)
GetActionLine event_type filters start = "2018-01-20T00:00:00-08:00" RFC3339 format end = "2018-01-26T23:59:59-08:00" RFC3339 format The time zone is needed to start the time bucketing on the hour requested. Bucketing every 3 hours the buckets start at the beginning of the day. 0 - 3, 3 - 6, 6 - 9, 9 - 12, 12 - 15, 15 - 18, 18 - 21, 21 - 0 One can not have 3 hour buckets start at 02:00 or any time within the above buckets This can be fixed by setting the time zone. The bucket will start at the beginning of the day in that timezone. The Elastic Search request
{ "aggregations": { "dateHisto": { "aggregations": { "items": { "terms": { "field": "entity_type" } } }, "date_histogram": { "extended_bounds": { "max": "2018-01-26T23:59:59-08:00", "min": "2018-01-20T00:00:00-08:00" }, "field": "recorded_at", "format": "yyyy-MM-dd'T'HH:mm:ssZ", "interval": "3h", "min_doc_count": 0, "time_zone": "-08:00" } } }, "query": { "bool": { "must": [ { "term": { "task": "delete" } }, { "range": { "recorded_at": { "format": "yyyy-MM-dd||yyyy-MM-dd-HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ", "from": "2018-01-20T00:00:00-08:00", "include_lower": true, "include_upper": true, "to": "2018-01-26T23:59:59-08:00" } } } ] } } }
interval - 24 must be divisible by this number For example 1, 2, 3, 4, 6, 8, 12, and 24 are valid. Where 5, 7, 9, 10, 11, and 13 are not valid values.
func (ElasticFeedStore) GetFeed ¶
GetFeed - get event feed entries with the provided query constraints
func (ElasticFeedStore) GetFeedSummary ¶
func (efs ElasticFeedStore) GetFeedSummary(query *feed.FeedSummaryQuery) (map[string]int64, error)
func (ElasticFeedStore) InitializeStore ¶
func (efs ElasticFeedStore) InitializeStore(ctx context.Context) error
InitializeStore runs the necessary initialization processes to make elasticsearch usable by creating the indices and aliases for documents to be added
func (ElasticFeedStore) JobCancel ¶
func (efs ElasticFeedStore) JobCancel(ctx context.Context, jobID string) error
func (ElasticFeedStore) JobStatus ¶
func (efs ElasticFeedStore) JobStatus(ctx context.Context, jobID string) (project_update_lib.JobStatus, error)
func (ElasticFeedStore) ListProjectUpdateTasks ¶
func (efs ElasticFeedStore) ListProjectUpdateTasks( ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error)
func (ElasticFeedStore) MonitorProjectUpdateTask ¶
func (efs ElasticFeedStore) MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, id project_update_lib.SerializedProjectUpdateTaskID) (project_update_lib.SerializedProjectUpdateTaskStatus, error)
func (ElasticFeedStore) ReindexFeedsToLatest ¶
func (efs ElasticFeedStore) ReindexFeedsToLatest(ctx context.Context, previousIndex string) (string, error)
ReindexFeedsToLatest reindex the feed index to the latest index
func (ElasticFeedStore) RunProjectUpdateTask ¶
func (efs ElasticFeedStore) RunProjectUpdateTask(ctx context.Context, projectUpdateID string, params map[string]string, projectTaggingRules map[string]*authz.ProjectRules) (project_update_lib.SerializedProjectUpdateTaskID, project_update_lib.SerializedProjectUpdateTaskStatus, error)
func (ElasticFeedStore) UpdateProjectTags ¶
func (efs ElasticFeedStore) UpdateProjectTags( ctx context.Context, projectTaggingRules map[string]*authz.ProjectRules) ([]string, error)
type FeedStore ¶
type FeedStore interface { // @param (context, indexName) DeleteIndex(ctx context.Context, index string) error // @param (context, jobID) JobStatus(context.Context, string) (project_update_lib.JobStatus, error) // @param (context, indexName) DoesIndexExists(context.Context, string) (bool, error) // @param (context, previousIndex) ReindexFeedsToLatest(context.Context, string) (string, error) // @param (context) InitializeStore(context.Context) error CreateFeedEntry(entry *feed.FeedEntry) (bool, error) GetFeed(query *feed.FeedQuery) ([]*feed.FeedEntry, int64, error) GetFeedSummary(query *feed.FeedSummaryQuery) (map[string]int64, error) GetActionLine(filters map[string][]string, startDate string, endDate string, timezone string, interval int, action string) (*feed.ActionLine, error) JobCancel(context.Context, string) error UpdateProjectTags(context.Context, map[string]*authz.ProjectRules) ([]string, error) //SerializedProjectUpdate ListProjectUpdateTasks(ctx context.Context) ([]project_update_lib.SerializedProjectUpdateTask, error) RunProjectUpdateTask(ctx context.Context, projectUpdateID string, params map[string]string, projectTaggingRules map[string]*authz.ProjectRules) (project_update_lib.SerializedProjectUpdateTaskID, project_update_lib.SerializedProjectUpdateTaskStatus, error) MonitorProjectUpdateTask(ctx context.Context, projectUpdateID string, id project_update_lib.SerializedProjectUpdateTaskID) (project_update_lib.SerializedProjectUpdateTaskStatus, error) CancelProjectUpdateTask(ctx context.Context, projectUpdateID string, id project_update_lib.SerializedProjectUpdateTaskID) error }