public class ElasticsearchEmbeddingStore extends Object implements EmbeddingStore<TextSegment>
| Modifier and Type | Class and Description |
|---|---|
static class |
ElasticsearchEmbeddingStore.Builder |
| Constructor and Description |
|---|
ElasticsearchEmbeddingStore(org.elasticsearch.client.RestClient restClient,
String indexName,
Integer dimension) |
ElasticsearchEmbeddingStore(String serverUrl,
String apiKey,
String userName,
String password,
String indexName,
Integer dimension)
Creates an instance of ElasticsearchEmbeddingStore.
|
| Modifier and Type | Method and Description |
|---|---|
String |
add(Embedding embedding) |
String |
add(Embedding embedding,
TextSegment textSegment) |
void |
add(String id,
Embedding embedding) |
List<String> |
addAll(List<Embedding> embeddings) |
List<String> |
addAll(List<Embedding> embeddings,
List<TextSegment> embedded) |
static ElasticsearchEmbeddingStore.Builder |
builder() |
List<EmbeddingMatch<TextSegment>> |
findRelevant(Embedding referenceEmbedding,
int maxResults,
double minScore) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindRelevantpublic ElasticsearchEmbeddingStore(String serverUrl, String apiKey, String userName, String password, String indexName, Integer dimension)
serverUrl - Elasticsearch Server URL (mandatory)apiKey - Elasticsearch API key (optional)userName - Elasticsearch userName (optional)password - Elasticsearch password (optional)indexName - Elasticsearch index name (optional). Default value: "default".
Index will be created automatically if not exists.dimension - Embedding vector dimension (mandatory when index does not exist yet).public static ElasticsearchEmbeddingStore.Builder builder()
public String add(Embedding embedding)
add in interface EmbeddingStore<TextSegment>public void add(String id, Embedding embedding)
add in interface EmbeddingStore<TextSegment>public String add(Embedding embedding, TextSegment textSegment)
add in interface EmbeddingStore<TextSegment>public List<String> addAll(List<Embedding> embeddings)
addAll in interface EmbeddingStore<TextSegment>public List<String> addAll(List<Embedding> embeddings, List<TextSegment> embedded)
addAll in interface EmbeddingStore<TextSegment>public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbedding, int maxResults, double minScore)
findRelevant in interface EmbeddingStore<TextSegment>Copyright © 2023. All rights reserved.