elasticsearch

package
v1.0.6-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 12 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchWriteError

type BatchWriteError struct {
	List   []interface{}
	Errors []error
}

BatchWriteError .

func (*BatchWriteError) Error

func (e *BatchWriteError) Error() string

Error .

type BatchWriteOption

type BatchWriteOption func(opts *BatchWriteOptions)

BatchWriteOption .

func WithBatchErrorHandler

func WithBatchErrorHandler(eh func(error) error) BatchWriteOption

WithBatchErrorHandler .

type BatchWriteOptions

type BatchWriteOptions struct {
	ErrorHandler func(error) error
}

BatchWriteOptions .

type BatchWriterConfig

type BatchWriterConfig struct {
	Type        string `file:"type" desc:"index type"`
	Parallelism uint64 `file:"parallelism" default:"4" desc:"parallelism"`
	Batch       struct {
		Size    uint64        `file:"size" default:"100" desc:"batch size"`
		Timeout time.Duration `file:"timeout" default:"30s" desc:"timeout to flush buffer for batch write"`
	} `file:"batch"`
	Retry int `file:"retry" desc:"retry if fail to write"`
}

BatchWriterConfig .

type Document

type Document struct {
	ID    string      `json:"id"`
	Index string      `json:"index"`
	Data  interface{} `json:"data"`
}

Document .

type EncodeFunc

type EncodeFunc func(data interface{}) (index, id, typ string, body interface{}, err error)

EncodeFunc .

type Interface

type Interface interface {
	URL() string
	Client() *elastic.Client
	NewBatchWriter(*BatchWriterConfig) writer.Writer
	NewBatchWriterWithOptions(c *WriterConfig, opts ...BatchWriteOption) writer.Writer
	NewWriter(opts *WriteOptions) *Writer
}

Interface .

type WriteOptions

type WriteOptions struct {
	Timeout time.Duration
	Enc     EncodeFunc
}

WriteOptions .

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer .

func NewWriter

func NewWriter(client *elastic.Client, timeout time.Duration, enc EncodeFunc) *Writer

NewWriter .

func (*Writer) Close

func (w *Writer) Close() error

Close .

func (*Writer) Write

func (w *Writer) Write(data interface{}) error

Write .

func (*Writer) WriteN

func (w *Writer) WriteN(list ...interface{}) (int, error)

WriteN .

type WriterConfig

type WriterConfig = BatchWriterConfig

WriterConfig deprecated, use BatchWriterConfig instead of

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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