elasticsearchv6

package
v4.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

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

type EsExecutor struct {
	Client *elastic.Client
	// contains filtered or unexported fields
}

EsExecutor wraps and exposes all elasticsearch tasks

func C

func C() *EsExecutor

C returns the elasticsearch client singleton

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

func (executor *EsExecutor) GetIndicesByAlias(ctx context.Context, alias string) ([]string, error)

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

func (executor *EsExecutor) PutAlias(ctx context.Context, patternIndex string, alias string) error

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.

func (*EsExecutor) RollOver

func (executor *EsExecutor) RollOver(ctx context.Context, alias string, ageCondition string, docsCondition int64) (string, string, error)

RollOver execute a full index rollover

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

Jump to

Keyboard shortcuts

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