Documentation ¶
Index ¶
- func Backoff() *connection.Backoff
- func InitializeBackoff(backoff *connection.Backoff)
- func InitializeGlobal(credentials *Credentials) error
- func Reconnect() error
- func ReplaceGlobals(credentials *Credentials) error
- type BulkResponse
- type Credentials
- type EsExecutor
- func (executor *EsExecutor) BulkIndex(ctx context.Context, docs []*models.Document) (*elastic.BulkResponse, error)
- func (executor *EsExecutor) BulkUpdate(ctx context.Context, docs []*models.Document, ...) (*elastic.BulkResponse, error)
- func (executor *EsExecutor) ClientHealthCheck(ctx context.Context) bool
- func (executor *EsExecutor) DeleteIndices(ctx context.Context, indices []string) error
- func (executor *EsExecutor) ExecuteSearch(ctx context.Context, search *elastic.SearchService) (*elastic.SearchResult, error)
- func (executor *EsExecutor) GetIndicesByAlias(ctx context.Context, alias string) ([]string, error)
- func (executor *EsExecutor) IndexExists(ctx context.Context, patternIndexExists string) (bool, error)
- func (executor *EsExecutor) MultiGet(ctx context.Context, docs []*models.Document) (*elastic.MgetResponse, error)
- func (executor *EsExecutor) MultiSearch(ctx context.Context, docs []*models.Document) (*elastic.MultiSearchResult, error)
- func (executor *EsExecutor) PutAlias(ctx context.Context, patternIndex string, alias string) error
- func (executor *EsExecutor) PutIndex(ctx context.Context, patternIndexExists string, indexName string) error
- func (executor *EsExecutor) PutTemplate(ctx context.Context, templateName string, templateBody *models.TemplateV6) error
- func (executor *EsExecutor) RollOver(ctx context.Context, alias string, ageCondition string, docsCondition int64) (string, string, error)
- type MGetResponse
- type SearchResult
- type SearchService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backoff ¶
func Backoff() *connection.Backoff
Backoff returns the elasticsearch backoff singleton
func InitializeBackoff ¶
func InitializeBackoff(backoff *connection.Backoff)
InitializeBackoff initialize the global elasticsearch backoff policy singleton
func InitializeGlobal ¶
func InitializeGlobal(credentials *Credentials) error
InitializeGlobal initialize the global elasticsearch client singleton
func Reconnect ¶
func Reconnect() error
Reconnect build a new ES connection and replace the existing singleton with it
func ReplaceGlobals ¶
func ReplaceGlobals(credentials *Credentials) error
ReplaceGlobals affect new elasticsearch credentials and connection to the global repository singleton
Types ¶
type BulkResponse ¶
type BulkResponse struct {
BResponse *elastic.BulkResponse
}
BulkResponse wraps elasticsearch BulkResponse
type Credentials ¶
type Credentials struct {
URLs []string
}
Credentials is used to store the elasticsearch credentials
type EsExecutor ¶
EsExecutor wraps and exposes all elasticsearch tasks
func NewEsExecutor ¶
func NewEsExecutor(ctx context.Context, urls []string) (*EsExecutor, error)
NewEsExecutor returns a pointer to an EsExecutor
func (*EsExecutor) BulkIndex ¶
func (executor *EsExecutor) BulkIndex(ctx context.Context, docs []*models.Document) (*elastic.BulkResponse, error)
BulkIndex inserts documents in bulk into an elasticsearch index, with a specific type.
func (*EsExecutor) BulkUpdate ¶
func (executor *EsExecutor) BulkUpdate(ctx context.Context, docs []*models.Document, fmerge func(*models.Document, *models.Document)) (*elastic.BulkResponse, error)
BulkUpdate insert, or partially updates documents already in an elasticsearch index following the provided merge function. Be careful, this method is not thread-safe TODO: A revoir la notion de merge
func (*EsExecutor) ClientHealthCheck ¶
func (executor *EsExecutor) ClientHealthCheck(ctx context.Context) bool
ClientHealthCheck checks if an elasticsearch cluster is up and running
func (*EsExecutor) DeleteIndices ¶
func (executor *EsExecutor) DeleteIndices(ctx context.Context, indices []string) error
DeleteIndices deletes an ensemble of indices
func (*EsExecutor) ExecuteSearch ¶
func (executor *EsExecutor) ExecuteSearch(ctx context.Context, search *elastic.SearchService) (*elastic.SearchResult, error)
ExecuteSearch execute a search
func (*EsExecutor) GetIndicesByAlias ¶
GetIndicesByAlias returns a slice of string containing all indices related to an alias
func (*EsExecutor) IndexExists ¶
func (executor *EsExecutor) IndexExists(ctx context.Context, patternIndexExists string) (bool, error)
IndexExists check if at least one index exists based on a pattern
func (*EsExecutor) MultiGet ¶
func (executor *EsExecutor) MultiGet(ctx context.Context, docs []*models.Document) (*elastic.MgetResponse, error)
MultiGet executes multiple get queries and return all results in a single response
func (*EsExecutor) MultiSearch ¶
func (executor *EsExecutor) MultiSearch(ctx context.Context, docs []*models.Document) (*elastic.MultiSearchResult, error)
MultiSearch executes multiple search queries and return all results in a single response
func (*EsExecutor) PutAlias ¶
PutAlias put a new index alias TODO: Must check if alias doesn't already exists
func (*EsExecutor) PutIndex ¶
func (executor *EsExecutor) PutIndex(ctx context.Context, patternIndexExists string, indexName string) error
PutIndex initializes a new index if it doesn't already exists. If no pattern is specified, the default pattern will be the index name
func (*EsExecutor) PutTemplate ¶
func (executor *EsExecutor) PutTemplate(ctx context.Context, templateName string, templateBody *models.TemplateV6) error
PutTemplate initializes given template if it doesn't already exists.
type MGetResponse ¶
type MGetResponse struct {
MgetResponse *elastic.MgetResponse
}
MGetResponse wraps elasticsearch MGetResponse
type SearchResult ¶
type SearchResult struct {
SResult *elastic.SearchResult
}
SearchResult wraps elasticsearch SearchResult
type SearchService ¶
type SearchService struct {
SService *elastic.SearchService
}
SearchService wraps elasticsearch SearchService