Documentation ¶
Index ¶
- Variables
- func FormatFilter(filter *filters.Filter, mapKey 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) RollIndex()
- func (c *Client) Search(typ string, 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(typ string, query elastic.Query, script *elastic.Script, indices ...string) error
- type ClientInterface
- type Config
- type Index
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 ¶ added in v0.19.0
FormatFilter creates a ElasticSearch request based on filters
func SetRollingRate ¶ added in v0.19.0
SetRollingRate override the default rolling index rate. Has to be called before client instantiation.
Types ¶
type Client ¶ added in v0.19.0
Client describes a ElasticSearch client connection
func NewClient ¶ added in v0.19.0
func NewClient(indices []Index, cfg Config, electionService common.MasterElectionService) (*Client, error)
NewClient creates a new ElasticSearch client based on configuration
func (*Client) AddEventListener ¶ added in v0.22.0
func (c *Client) AddEventListener(listener storage.EventListener)
AddEventListener add event listener
func (*Client) BulkDelete ¶ added in v0.19.0
BulkDelete an object with the indexer
func (*Client) RollIndex ¶ added in v0.19.0
func (c *Client) RollIndex()
RollIndex forces a rolling index
func (*Client) Search ¶ added in v0.19.0
func (c *Client) Search(typ string, query elastic.Query, opts filters.SearchQuery, indices ...string) (*elastic.SearchResult, error)
Search an object
func (*Client) Start ¶ added in v0.19.0
func (c *Client) Start()
Start the Elasticsearch client background jobs
type ClientInterface ¶ added in v0.19.0
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(typ string, query elastic.Query, pagination filters.SearchQuery, indices ...string) (*elastic.SearchResult, error) Start() AddEventListener(listener storage.EventListener) UpdateByScript(typ string, query elastic.Query, script *elastic.Script, indices ...string) error }
ClientInterface describes the mechanism API of ElasticSearch database client
type Config ¶ added in v0.18.0
type Config struct { ElasticHost string BulkMaxDelay int EntriesLimit int AgeLimit int IndicesLimit int }
Config describes configuration for elasticsearch
type Index ¶ added in v0.19.0
Index defines a Client Index
func (*Index) FullName ¶ added in v0.19.0
FullName returns the full name of an index, prefix, name, version, suffix in case of rolling index
func (*Index) IndexWildcard ¶ added in v0.19.0
IndexWildcard returns the Index wildcard search string used to all the indexes of an index definition. Useful to request rolled over indexes.