Documentation ¶
Index ¶
- Variables
- func FormatFilter(filter *filters.Filter, normalizeKey func(string) string) elastic.Query
- func SetRollingRate(rate time.Duration)
- type Client
- func (c *Client) AddEventListener(listener storage.EventListener)
- func (c *Client) BulkDelete(index Index, id string) error
- func (c *Client) BulkIndex(index Index, id string, data interface{}) error
- func (c *Client) Delete(index Index, id string) (*elastic.DeleteResponse, error)
- func (c *Client) Get(index Index, id string) (*elastic.GetResult, error)
- func (c *Client) GetClient() *elastic.Client
- func (c *Client) Index(index Index, id string, data interface{}) error
- func (c *Client) Scroll(hits chan<- *elastic.SearchHit, query elastic.Query, opts filters.SearchQuery, ...) error
- func (c *Client) Search(query elastic.Query, opts filters.SearchQuery, indices ...string) (*elastic.SearchResult, error)
- func (c *Client) Start()
- func (c *Client) Started() bool
- func (c *Client) Stop()
- func (c *Client) UpdateByScript(query elastic.Query, script *elastic.Script, indices ...string) error
- type ClientInterface
- type Config
- type ErrorLogger
- type Index
- type InfoLogger
- type TraceLogger
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadConfig error bad configuration file ErrBadConfig = func(reason string) error { return fmt.Errorf("Config file is misconfigured: %s", reason) } // ErrIndexTypeNotFound error index type used but not defined ErrIndexTypeNotFound = errors.New("Index type not found in the indices map") )
var ( // RollingRate delay between two potential rolling index RollingRate = time.Minute )
Functions ¶
func FormatFilter ¶
FormatFilter creates a ElasticSearch request based on filters
func SetRollingRate ¶
SetRollingRate override the default rolling index rate. Has to be called before client instantiation.
Types ¶
type Client ¶
Client describes a ElasticSearch client connection
func NewClient ¶
func NewClient(indices []Index, cfg Config, electionService etcd.MasterElectionService) (*Client, error)
NewClient creates a new ElasticSearch client based on configuration
func (*Client) AddEventListener ¶
func (c *Client) AddEventListener(listener storage.EventListener)
AddEventListener add event listener
func (*Client) BulkDelete ¶
BulkDelete an object with the indexer
func (*Client) Scroll ¶
func (c *Client) Scroll(hits chan<- *elastic.SearchHit, query elastic.Query, opts filters.SearchQuery, indices ...string) error
Scroll objects using the Scroll API. Send all hits to the hits channel. Sort options are ignored, they impose a big performace hit.
type ClientInterface ¶
type ClientInterface interface { Index(index Index, id string, data interface{}) error BulkIndex(index Index, id string, data interface{}) error Get(index Index, id string) (*elastic.GetResult, error) Delete(index Index, id string) (*elastic.DeleteResponse, error) BulkDelete(index Index, id string) error Search(query elastic.Query, pagination filters.SearchQuery, indices ...string) (*elastic.SearchResult, error) Scroll(hits chan<- *elastic.SearchHit, query elastic.Query, pagination filters.SearchQuery, indices ...string) error Start() AddEventListener(listener storage.EventListener) UpdateByScript(query elastic.Query, script *elastic.Script, indices ...string) error }
ClientInterface describes the mechanism API of ElasticSearch database client
type Config ¶
type Config struct { ElasticHosts []string InsecureSkipVerify bool Username string Password string BulkMaxDelay int TotalFieldsLimit int EntriesLimit int AgeLimit int IndicesLimit int NoSniffing bool IndexPrefix string SniffingScheme string NoHealthcheck bool Debug bool }
Config describes configuration for elasticsearch
type ErrorLogger ¶
type ErrorLogger struct{}
ErrorLogger implements the oliviere/elastic Logger interface to be used with error mesages
func (ErrorLogger) Printf ¶
func (l ErrorLogger) Printf(format string, v ...interface{})
Printf sends elastic error messages to skydive logger Error
type Index ¶
Index defines a Client Index
func (*Index) FullName ¶
FullName returns the full name of an index, prefix, name, version, suffix in case of rolling index
func (*Index) IndexWildcard ¶
IndexWildcard returns the Index wildcard search string used to all the indexes of an index definition. Useful to request rolled over indexes.
type InfoLogger ¶
type InfoLogger struct{}
InfoLogger implements the oliviere/elastic Logger interface to be used with info messages
func (InfoLogger) Printf ¶
func (l InfoLogger) Printf(format string, v ...interface{})
Printf sends elastic info messages to skydive logger Info
type TraceLogger ¶
type TraceLogger struct{}
TraceLogger implements the oliviere/elastic Logger interface to be used with trace messages
func (TraceLogger) Printf ¶
func (l TraceLogger) Printf(format string, v ...interface{})
Printf sends elastic trace messages to skydive logger Debug