Skip to main content
Alibaba Cloud Opensearch is a one-stop platform to develop intelligent search services. OpenSearch was built on the large-scale distributed search engine developed by Alibaba. OpenSearch serves more than 500 business cases in Alibaba Group and thousands of Alibaba Cloud customers. OpenSearch helps develop search services in different search scenarios, including e-commerce, O2O, multimedia, the content industry, communities and forums, and big data query in enterprises.
OpenSearch helps you develop high-quality, maintenance-free, and high-performance intelligent search services to provide your users with high search efficiency and accuracy.
OpenSearch provides the vector search feature. In specific scenarios, especially test question search and image search scenarios, you can use the vector search feature together with the multimodal search feature to improve the accuracy of search results.
This notebook shows how to use functionality related to the Alibaba Cloud OpenSearch Vector Search Edition.

Setting up

Purchase an instance and configure it

Purchase OpenSearch Vector Search Edition from Alibaba Cloud and configure the instance according to the help documentation. To run, you should have an OpenSearch Vector Search Edition instance up and running.

Alibaba Cloud OpenSearch Vector Store class

AlibabaCloudOpenSearch class supports functions:
  • add_texts
  • add_documents
  • from_texts
  • from_documents
  • similarity_search
  • asimilarity_search
  • similarity_search_by_vector
  • asimilarity_search_by_vector
  • similarity_search_with_relevance_scores
  • delete_doc_by_texts
Read the help document to quickly familiarize and configure OpenSearch Vector Search Edition instance. If you encounter any problems during use, please feel free to contact [email protected], and we will do our best to provide you with assistance and support. After the instance is up and running, follow these steps to split documents, get embeddings, connect to the alibaba cloud opensearch instance, index documents, and perform vector retrieval. We need to install the following Python packages first.
We want to use OpenAIEmbeddings so we have to get the OpenAI API Key.

Example

Split documents and get embeddings.
Create opensearch settings.
Create an opensearch access instance by settings.
or
Add texts and build index.
Query and retrieve data.
Query and retrieve data with metadata.
If you encounter any problems during use, please feel free to contact [email protected], and we will do our best to provide you with assistance and support.