Installation
Elasticsearch support requires the Elasticsearch client as an extra dependency.Usage
The TypeScript SDK uses camelCase config keys:
collectionName, embeddingModelDims, cloudId, apiKey, useSsl, verifyCerts, caCerts, autoCreateIndex, and username (in place of the Python user). collectionName and embeddingModelDims are required. Because the vector store embeds text with your configured embedder before writing, set an embedder in the config as shown above.Config
Here are the parameters available for configuring Elasticsearch:Features
- Efficient vector search using Elasticsearch’s native k-NN search
- Support for both local and cloud deployments (Elastic Cloud)
- Multiple authentication methods (Basic Auth, API Key)
- Automatic index creation with optimized mappings for vector search
- Memory isolation through payload filtering
- Custom search query function to customize the search query
Custom Search Query
custom_search_query is available in the Python SDK only. The TypeScript SDK runs a fixed k-NN query with optional metadata filters.custom_search_query parameter allows you to customize the search query when Memory.search is called.
Example
query: a query vector used inMemory.searchlimit: a number of results used inMemory.searchfilters: a dictionary of key-value pairs used inMemory.search. You can add custom pairs for the custom search query.