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 ¶
- type Adapter
- func (a *Adapter) BulkDelete(ctx context.Context, index string, documentIDs []string) error
- func (a *Adapter) BulkIndex(ctx context.Context, index string, documents []any) error
- func (a *Adapter) CreateIndex(ctx context.Context, indexName string, settings *search.IndexSettings) error
- func (a *Adapter) Delete(ctx context.Context, index, id string) error
- func (a *Adapter) Health(ctx context.Context) error
- func (a *Adapter) Index(ctx context.Context, req *search.IndexRequest) error
- func (a *Adapter) IndexExists(ctx context.Context, indexName string) (bool, error)
- func (a *Adapter) Search(ctx context.Context, req *search.Request) (*search.Response, error)
- func (a *Adapter) Type() search.Engine
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 (*Adapter) BulkDelete ¶
func (*Adapter) CreateIndex ¶
func (*Adapter) IndexExists ¶
Click to show internal directories.
Click to hide internal directories.