opensearch

package
v0.0.0-...-ada256f Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(client *Client, cfg *Config) index.Index

New returns a new index.

Types

type Client

type Client struct {
	*instr.Instrumentation
	// contains filtered or unexported fields
}

Client for search index.

func NewClient

func NewClient(cfg *ClientConfig, i *instr.Instrumentation) (*Client, error)

NewClient returns a configured search index, or an error.

func (*Client) NewIndex

func (c *Client) NewIndex(name string) index.Index

NewIndex returns a new index given with given name.

func (*Client) Work

func (c *Client) Work(ctx context.Context) error

Work starts (and closes) a client worker.

type ClientConfig

type ClientConfig struct {
	URL       string
	Transport http.RoundTripper
	Debug     bool

	BulkIndexerWorkers      int
	BulkIndexerFlushBytes   int
	BulkIndexerFlushTimeout time.Duration

	BulkGetterBatchSize    int
	BulkGetterBatchTimeout time.Duration
}

ClientConfig configures search index.

type Config

type Config struct {
	Name string
}

Config represents the configuration for an OpenSearch index.

type Index

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

Index wraps an OpenSearch index to store documents

func (*Index) Delete

func (i *Index) Delete(ctx context.Context, id string) error

Delete item from index

func (*Index) Get

func (i *Index) Get(ctx context.Context, id string, dst interface{}, fields ...string) (bool, error)

Get retreives `fields` from document with `id` from the index, returning: - (true, decoding_error) if found (decoding error set when errors in json) - (false, nil) when not found - (false, error) otherwise

func (*Index) Index

func (i *Index) Index(ctx context.Context, id string, properties interface{}) error

Index a document's properties, identified by id

func (*Index) String

func (i *Index) String() string

String returns the name of the index, for convenient logging.

func (*Index) Update

func (i *Index) Update(ctx context.Context, id string, properties interface{}) error

Update a document's properties, given id

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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