elasticsearch

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 11 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 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 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