OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0.This notebook shows how to use functionality related to theOpenSearch
is a distributed search and analytics engine based onApache Lucene
.
OpenSearch
database.
To run, you should have an OpenSearch instance up and running: see here for an easy Docker installation.
similarity_search
by default performs the Approximate k-NN Search which uses one of the several algorithms like lucene, nmslib, faiss recommended for
large datasets. To perform brute force search we have other search methods known as Script Scoring and Painless Scripting.
Check this for more details.
Installation
Install the Python client.similarity_search using Approximate k-NN
similarity_search
using Approximate k-NN
Search with Custom Parameters
similarity_search using Script Scoring
similarity_search
using Script Scoring
with Custom Parameters
similarity_search using Painless Scripting
similarity_search
using Painless Scripting
with Custom Parameters
Maximum marginal relevance search (MMR)
If you’d like to look up for some similar documents, but you’d also like to receive diverse results, MMR is method you should consider. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents.Using a preexisting OpenSearch instance
It’s also possible to use a preexisting OpenSearch instance with documents that already have vectors present.Using AOSS (Amazon OpenSearch Service Serverless)
It is an example of theAOSS
with faiss
engine and efficient_filter
.
We need to install several python
packages.