Documentation
¶
Index ¶
- Variables
- func AddAction[T ~string](ctx context.Context, actions ...*Action[T]) error
- func Flush(ctx context.Context) error
- func IndexDocuments[T ~string, O Document[T]](ctx context.Context, index string, documents ...O) error
- func Shutdown(ctx context.Context) error
- type Action
- type ActionOption
- type Document
- type Indexer
- type IndexerOption
- type Operation
- type PartialDocument
Constants ¶
This section is empty.
Variables ¶
var (
ErrInitIndexer = errors.New("indexer not initialised")
)
Functions ¶
func Flush ¶ added in v0.190.3
Flush will flush all pending bulk actions, forcing Elasticsearch to process them.
Types ¶
type Action ¶ added in v0.190.3
type Action[T ~string] struct { // contains filtered or unexported fields }
Action represents a single bulk action.
type ActionOption ¶ added in v0.190.3
ActionOption is a functional option applied to an action.
func AsOperation ¶ added in v0.190.3
func AsOperation[T ~string](op Operation) ActionOption[T]
func ToIndex ¶
func ToIndex[T ~string](index string) ActionOption[T]
ToIndex option defines the index to operate on.
func WithRetries ¶ added in v0.190.3
func WithRetries[T ~string](retries int) ActionOption[T]
WithRetries option defines the number of retries if this action fails. Set to zero to disable retries.
type Document ¶ added in v0.190.3
type Document[T ~string] interface { GetID() T }
Document represents any type of document stored in any index.
type Indexer ¶ added in v0.190.3
type Indexer struct {
esutil.BulkIndexer
}
Indexer represents a bulk indexer instance. The indexer instance is generally created once when needed and then reused throughout the application life cycle.
func NewIndexer ¶ added in v0.190.3
func NewIndexer(ctx context.Context, options ...IndexerOption) (*Indexer, error)
NewIndexer creates a new indexer. It will initialize the indexer once, if not done already, then return the instance.
type IndexerOption ¶ added in v0.190.3
type IndexerOption func(*esutil.BulkIndexerConfig)
IndexerOption is a functional option to apply to an indexer instance.
func WithFlushInterval ¶ added in v0.190.3
func WithFlushInterval(interval, jitter time.Duration) IndexerOption
WithFlushInterval defines the interval (with jitter) after which any pending bulk operations will be flushed.
type PartialDocument ¶ added in v0.190.3
PartialDocument represents partial data for a given document.
func (*PartialDocument) GetID ¶ added in v0.190.3
func (d *PartialDocument) GetID() string