elasticsearch

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	// RollingRate delay between two potential rolling index
	RollingRate = time.Minute
)

Functions

func FormatFilter added in v0.19.0

func FormatFilter(filter *filters.Filter, mapKey string) elastic.Query

FormatFilter creates a ElasticSearch request based on filters

func SetRollingRate added in v0.19.0

func SetRollingRate(rate time.Duration)

SetRollingRate override the default rolling index rate. Has to be called before client instantiation.

Types

type Client added in v0.19.0

type Client struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

func (c *Client) BulkDelete(index Index, id string) error

BulkDelete an object with the indexer

func (*Client) BulkIndex added in v0.19.0

func (c *Client) BulkIndex(index Index, id string, data interface{}) error

BulkIndex returns the bulk index from the indexer

func (*Client) Delete added in v0.19.0

func (c *Client) Delete(index Index, id string) (*elastic.DeleteResponse, error)

Delete an object

func (*Client) Get added in v0.19.0

func (c *Client) Get(index Index, id string) (*elastic.GetResult, error)

Get an object

func (*Client) GetClient added in v0.19.0

func (c *Client) GetClient() *elastic.Client

GetClient returns the elastic client object

func (*Client) Index added in v0.19.0

func (c *Client) Index(index Index, id string, data interface{}) error

Index returns the skydive index

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

func (*Client) Started added in v0.19.0

func (c *Client) Started() bool

Started is the client already started ?

func (*Client) Stop added in v0.19.0

func (c *Client) Stop()

Stop Elasticsearch background client

func (*Client) UpdateByScript added in v0.22.0

func (c *Client) UpdateByScript(typ string, query elastic.Query, script *elastic.Script, indices ...string) error

UpdateByScript updates the document using the given script

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

type Index struct {
	Name      string
	Type      string
	Mapping   string
	RollIndex bool
	URL       string
}

Index defines a Client Index

func (*Index) Alias added in v0.19.0

func (i *Index) Alias() string

Alias returns the Alias of the index

func (*Index) FullName added in v0.19.0

func (i *Index) FullName() string

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

func (i *Index) IndexWildcard() string

IndexWildcard returns the Index wildcard search string used to all the indexes of an index definition. Useful to request rolled over indexes.

Jump to

Keyboard shortcuts

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