elasticsearchVS

package
v0.0.0-...-1ea5cf0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 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 ESOption

type ESOption struct {
	Username string
	Password string

	CloudID      string
	APIKey       string
	ServiceToken string
}

type ElasticsearchVectorStore

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

ElasticsearchVectorStore provide access to elasticsearch

func NewElasticsearchVectorStore

func NewElasticsearchVectorStore(host string, embeddingModel model.EmbeddingModel, esOption ...func(*ESOption)) (EVS *ElasticsearchVectorStore, err error)

NewElasticsearchVectorStore return new Elasticsearch instance

func (*ElasticsearchVectorStore) AddDocuments

func (ES *ElasticsearchVectorStore) AddDocuments(ctx context.Context, indexName string, documents []document.Document) (batchErr []error, err error)

AddDocuments store a batch of documents to vector index it will also store embedding of the document using specified embedding model If the index doesnt exist, it will create one with default schema

func (*ElasticsearchVectorStore) AddText

func (ES *ElasticsearchVectorStore) AddText(ctx context.Context, indexName string, input string) (err error)

AddText store text to vector index it will also store embedding of the text using specified embedding model If the index doesnt exist, it will create one with default schema

func (*ElasticsearchVectorStore) DeleteIndex

func (ES *ElasticsearchVectorStore) DeleteIndex(ctx context.Context, indexName string) (err error)

DeleteIndex drop the index

func (*ElasticsearchVectorStore) Search

func (ES *ElasticsearchVectorStore) Search(ctx context.Context, indexName string, query string, options ...func(*datastore.Option)) (docs []document.Document, err error)

Search using a query string

func (*ElasticsearchVectorStore) SearchVector

func (ES *ElasticsearchVectorStore) SearchVector(ctx context.Context, indexName string, vector []float32, options ...func(*datastore.Option)) (docs []document.Document, err error)

SearchVector by providing the vector from embedding function

Jump to

Keyboard shortcuts

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