OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0.In this notebook, we’ll demo theOpenSearch
is a distributed search and analytics engine based onApache Lucene
.
SelfQueryRetriever
with an OpenSearch
vector store.
Creating an OpenSearch vector store
First, we’ll want to create anOpenSearch
vector store and seed it with some data. We’ve created a small demo set of documents that contain summaries of movies.
Note: The self-query retriever requires you to have lark
installed (pip install lark
). We also need the opensearch-py
package.
Creating our self-querying retriever
Now we can instantiate our retriever. To do this we’ll need to provide some information upfront about the metadata fields that our documents support and a short description of the document contents.Testing it out
And now we can try actually using our retriever!Filter k
We can also use the self query retriever to specifyk
: the number of documents to fetch.
We can do this by passing enable_limit=True
to the constructor.