opensearch

package module
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: 9 Imported by: 0

Documentation

Overview

Package opensearch provides an OpenSearch driver for ncore/data.

This driver uses opensearch-go (github.com/opensearch-project/opensearch-go/v2) as the underlying client. It registers itself automatically when imported:

import _ "github.com/ncobase/ncore/data/opensearch"

OpenSearch is AWS's fork of Elasticsearch, providing full compatibility with Elasticsearch APIs while adding additional features.

Example usage:

driver, err := data.GetSearchDriver("opensearch")
if err != nil {
    log.Fatal(err)
}

cfg := &config.OpenSearch{
    Addresses: []string{"https://localhost:9200"},
    Username:  "admin",
    Password:  "admin",
}

conn, err := driver.Connect(ctx, cfg)
client := conn.(*client.Client)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

func NewAdapter

func NewAdapter(c *client.Client) *Adapter

func (*Adapter) BulkDelete

func (a *Adapter) BulkDelete(ctx context.Context, index string, documentIDs []string) error

func (*Adapter) BulkIndex

func (a *Adapter) BulkIndex(ctx context.Context, index string, documents []any) error

func (*Adapter) CreateIndex

func (a *Adapter) CreateIndex(ctx context.Context, indexName string, settings *search.IndexSettings) error

func (*Adapter) Delete

func (a *Adapter) Delete(ctx context.Context, index, id string) error

func (*Adapter) Health

func (a *Adapter) Health(ctx context.Context) error

func (*Adapter) Index

func (a *Adapter) Index(ctx context.Context, req *search.IndexRequest) error

func (*Adapter) IndexExists

func (a *Adapter) IndexExists(ctx context.Context, indexName string) (bool, error)

func (*Adapter) Search

func (a *Adapter) Search(ctx context.Context, req *search.Request) (*search.Response, error)

func (*Adapter) Type

func (a *Adapter) Type() search.Engine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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