client

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client OpenSearch client

func NewClient

func NewClient(addresses []string, username, password string, insecure bool) (*Client, error)

NewClient creates a new OpenSearch client

func (*Client) BulkIndex

func (c *Client) BulkIndex(ctx context.Context, indexName string, documents []any) error

BulkIndex indexes multiple documents in OpenSearch

func (*Client) CreateIndex

func (c *Client) CreateIndex(ctx context.Context, indexName string, mappings string) error

CreateIndex creates a new index with optional mappings

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(ctx context.Context, indexName, documentID string) error

DeleteDocument deletes a document from OpenSearch

func (*Client) DeleteIndex

func (c *Client) DeleteIndex(ctx context.Context, indexName string) error

DeleteIndex deletes an index

func (*Client) GetClient

func (c *Client) GetClient() *opensearchapi.Client

GetClient returns the OpenSearch client

func (*Client) Health

func (c *Client) Health(ctx context.Context) (string, error)

Health checks cluster health

func (*Client) IndexDocument

func (c *Client) IndexDocument(ctx context.Context, indexName string, documentID string, document any) error

IndexDocument indexes a document in OpenSearch

func (*Client) IndexExists

func (c *Client) IndexExists(ctx context.Context, indexName string) (bool, error)

IndexExists checks if an index exists

func (*Client) Search

func (c *Client) Search(ctx context.Context, indexName, query string) (*opensearchapi.SearchResp, error)

Search performs a search in OpenSearch

Jump to

Keyboard shortcuts

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