Class AbstractElasticsearchEmbeddingStore
java.lang.Object
dev.langchain4j.store.embedding.elasticsearch.AbstractElasticsearchEmbeddingStore
- All Implemented Interfaces:
EmbeddingStore<TextSegment>
- Direct Known Subclasses:
ElasticsearchContentRetriever, ElasticsearchEmbeddingStore
public abstract class AbstractElasticsearchEmbeddingStore
extends Object
implements EmbeddingStore<TextSegment>
Represents an Elasticsearch index as an embedding store.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected co.elastic.clients.elasticsearch.ElasticsearchClientprotected ElasticsearchConfigurationprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Embedding embedding, TextSegment textSegment) voidvoidvoidaddAllText(List<String> texts) fullTextSearch(String textQuery) hybridSearch(EmbeddingSearchRequest embeddingSearchRequest, String textQuery) protected voidinitialize(ElasticsearchConfiguration configuration, co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName) Initialize using an ElasticsearchClientprotected voidinitialize(ElasticsearchConfiguration configuration, org.elasticsearch.client.RestClient restClient, String indexName) Deprecated, for removal: This API element is subject to removal in a future version.voidThe Elasticsearch implementation will simply drop the index instead of removing all documents one by one.voidvoidremoveAll(Collection<String> ids) search(EmbeddingSearchRequest embeddingSearchRequest) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmbeddingStore
addAll, addListener, addListeners, generateIds, remove
-
Field Details
-
configuration
-
client
protected co.elastic.clients.elasticsearch.ElasticsearchClient client -
indexName
-
-
Constructor Details
-
AbstractElasticsearchEmbeddingStore
public AbstractElasticsearchEmbeddingStore()
-
-
Method Details
-
initialize
@Deprecated(forRemoval=true) protected void initialize(ElasticsearchConfiguration configuration, org.elasticsearch.client.RestClient restClient, String indexName) Deprecated, for removal: This API element is subject to removal in a future version.Initialize using a RestClient- Parameters:
configuration- Elasticsearch configuration to use (Knn, Script, FullText or Hybrid)restClient- Elasticsearch Rest Client (mandatory)indexName- Elasticsearch index name (optional). Default value: "default". Index will be created automatically if not exists.
-
initialize
protected void initialize(ElasticsearchConfiguration configuration, co.elastic.clients.elasticsearch.ElasticsearchClient client, String indexName) Initialize using an ElasticsearchClient- Parameters:
configuration- Elasticsearch configuration to use (Knn or Script)client- Elasticsearch Client (mandatory)indexName- Elasticsearch index name (optional). Default value: "default". Index will be created automatically if not exists.
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
add
-
add
-
addAllText
-
add
- Specified by:
addin interfaceEmbeddingStore<TextSegment>
-
addAll
- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>
-
search
- Specified by:
searchin interfaceEmbeddingStore<TextSegment>
-
hybridSearch
public EmbeddingSearchResult<TextSegment> hybridSearch(EmbeddingSearchRequest embeddingSearchRequest, String textQuery) -
fullTextSearch
-
removeAll
- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
removeAll
- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
removeAll
public void removeAll()The Elasticsearch implementation will simply drop the index instead of removing all documents one by one.- Specified by:
removeAllin interfaceEmbeddingStore<TextSegment>
-
addAll
- Specified by:
addAllin interfaceEmbeddingStore<TextSegment>
-
initialize(ElasticsearchConfiguration, ElasticsearchClient, String)