langchainrb
langchainrb copied to clipboard
feat(vectorsearch): add metadata support to Elasticsearch adapter
Adds the ability to store and search by metadata in the Elasticsearch vector search provider:
- Extended
add_textsandupdate_textsto accept optionalmetadatasparameter - Updated index mapping to include a dynamic
metadataobject field - Added
filterparameter to similarity search methods for metadata-based filtering - All changes maintain backward compatibility with existing code
- Added comprehensive test coverage for the new functionality
- Created an example script to demonstrate metadata usage with Elasticsearch
This enhancement brings the Elasticsearch adapter to parity with other vector stores like Pinecone, Chroma, PGVector and Qdrant that already supported metadata. Users can now store arbitrary metadata alongside their text and embedding vectors, then filter search results based on metadata fields.