elasticsearch

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewBulkIndexer added in v1.6.0

func NewBulkIndexer(ctx context.Context, client *elasticsearch.Client) (esutil.BulkIndexer, error)

NewBulkIndexer returns elasticsearch bulk indexer with default options.

func NewBulkIndexerWithConfigPath added in v1.6.0

func NewBulkIndexerWithConfigPath(ctx context.Context, path string, client *elasticsearch.Client) (esutil.BulkIndexer, error)

NewBulkIndexerWithConfigPath returns elasticsearch bulk indexer with options from config path.

func NewBulkIndexerWithOptions added in v1.6.0

func NewBulkIndexerWithOptions(ctx context.Context, options *BulkOptions, client *elasticsearch.Client) (bi esutil.BulkIndexer, err error)

NewBulkIndexerWithOptions returns elasticsearch bulk indexer with options.

func NewClient

func NewClient(ctx context.Context, plugins ...Plugin) (*elasticsearch.Client, error)

NewClient returns elasticsearch client with default options.

func NewClientWithConfigPath

func NewClientWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*elasticsearch.Client, error)

NewClientWithConfigPath returns elasticsearch client with options from config path.

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, o *Options, plugins ...Plugin) (client *elasticsearch.Client, err error)

NewClientWithOptions returns elasticsearch client with options.

Types

type BulkOptions added in v1.6.0

type BulkOptions struct {
	NumWorkers    int
	FlushInterval time.Duration
	FlushBytes    int
	Pipeline      string
	Timeout       time.Duration
	Index         string
}

func NewBulkOptions added in v1.6.0

func NewBulkOptions() (*BulkOptions, error)

NewBulkOptions returns options from config file or environment vars.

func NewBulkOptionsWithPath added in v1.6.0

func NewBulkOptionsWithPath(path string) (opts *BulkOptions, err error)

NewBulkOptionsWithPath unmarshals a given key path into options and returns it.

type DebugLogger added in v1.6.0

type DebugLogger struct {
}

func (*DebugLogger) Printf added in v1.6.0

func (l *DebugLogger) Printf(msg string, args ...interface{})

type Logger

type Logger struct {
}

Logger implements the estransport.Logger interface.

func (*Logger) LogRoundTrip

func (l *Logger) LogRoundTrip(
	req *http.Request,
	res *http.Response,
	err error,
	start time.Time,
	dur time.Duration,
) error

LogRoundTrip prints the information about request and response.

func (*Logger) RequestBodyEnabled

func (l *Logger) RequestBodyEnabled() bool

RequestBodyEnabled makes the client pass request body to logger.

func (*Logger) ResponseBodyEnabled

func (l *Logger) ResponseBodyEnabled() bool

RequestBodyEnabled makes the client pass response body to logger.

type ManagedClient

type ManagedClient struct {
	Client  *elasticsearch.Client
	Plugins []Plugin
	Options *Options
}

ManagedClient struct that represents a managed client.

func NewManagedClient

func NewManagedClient(ctx context.Context, plugins ...Plugin) (*ManagedClient, error)

NewManagedClient returns a managed client with default options.

func NewManagedClientWithConfigPath

func NewManagedClientWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*ManagedClient, error)

NewManagedClientWithConfigPath returns a managed client with options from config path.

func NewManagedClientWithOptions

func NewManagedClientWithOptions(ctx context.Context, opts *Options, plugins ...Plugin) (*ManagedClient, error)

NewManagedClientWithOptions returns a managed client with options.

type Options

type Options struct {
	Addresses             []string
	Username              string
	Password              string
	CloudID               string `config:"cloudID"`
	APIKey                string `config:"APIKey"`
	CACert                string `config:"CACert"`
	RetryOnStatus         []int
	DisableRetry          bool
	EnableRetryOnTimeout  bool
	MaxRetries            int
	DiscoverNodesOnStart  bool
	DiscoverNodesInterval time.Duration
	EnableMetrics         bool
	EnableDebugLogger     bool
	RetryBackoff          time.Duration
}

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

type Plugin

type Plugin func(context.Context, *elasticsearch.Client) error

Plugin defines a function to process plugin.

Directories

Path Synopsis
examples
plugins

Jump to

Keyboard shortcuts

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