Skip to main content
这将帮助你开始使用 Elasticsearch 键值存储。 所有 ElasticsearchEmbeddingsCache 功能和配置的详细文档请前往 API reference.

概述

The ElasticsearchEmbeddingsCache is a ByteStore implementation that uses your Elasticsearch instance for efficient storage and retrieval of embeddings.

集成详情

设置

To create a ElasticsearchEmbeddingsCache byte store, you’ll need an Elasticsearch cluster. You can set one up locally or create an Elastic account.

安装

The LangChain ElasticsearchEmbeddingsCache integration lives in the langchain-elasticsearch package:

Instantiation

Now we can instantiate our byte store:

使用方法

You can set data under keys like this using the mset method:
And you can delete data using the mdelete method:

Use as an embeddings cache

Like other ByteStores, you can use an ElasticsearchEmbeddingsCache instance for persistent caching in document ingestion for RAG. However, cached vectors won’t be searchable by default. The developer can customize the building of the Elasticsearch document in order to add indexed vector field. This can be done by subclassing and overriding methods:
When overriding the mapping and the document building, please only make additive modifications, keeping the base mapping intact.

API 参考

所有 ElasticsearchEmbeddingsCache features and configurations, head to the API reference