Documentation
¶
Overview ¶
Package opensearch is the minimal REST client for the OpenSearch projection target (ADR-013). Only the operations the projector needs are implemented: index management, document get/upsert/delete. No external SDK dependency: the projector talks to the OpenSearch HTTP API directly.
Index ¶
- Variables
- type Client
- func (c *Client) Delete(ctx context.Context, id string) error
- func (c *Client) EnsureIndex(ctx context.Context, mapping []byte) error
- func (c *Client) Get(ctx context.Context, id string) ([]byte, error)
- func (c *Client) Index(ctx context.Context, id string, document any) error
- func (c *Client) Ping(ctx context.Context) error
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound reports a missing document or index. ErrNotFound = errors.New("opensearch document not found") // operation; callers retry with backoff. ErrUnavailable = errors.New("opensearch unavailable") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimal OpenSearch REST client.
func New ¶
New connects to the OpenSearch cluster address, e.g. http://127.0.0.1:39200.
func (*Client) EnsureIndex ¶
EnsureIndex creates the index with the given mapping if it does not exist (idempotent: an existing index is left untouched).
type Option ¶
type Option func(*Client)
Option configures the client.
func WithCredentials ¶
WithCredentials sets basic authentication (required when the security plugin is enabled).
func WithHTTPClient ¶
WithHTTPClient injects the HTTP client (tests and custom transports).