Hi Everyone,
I have my data stored in the collection in the Qdrant vector database. The metadata(payload) schema for all points is predefined by myself. How do I use
VectorStoreIndex.from_vector_store() to create a query engine? From my experiment, it seems that the data should be stored in a specific schema (defined by llamaindex) to successfully create the query engine based on
from_vector_store().
Experiment 1: (Load data from a directory)
client = QdrantClient(host="localhost", port=6333)
vector_store = QdrantVectorStore(client=client, collection_name=collection_name)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
- I first load documents (download from an example) with
documents = SimpleDirectoryReader(<path/to/data>).load_data()
and create an index with VectorStoreIndex.from_documents
. With from_documents, it upserts the data into a predefined collection_name in Qdrant VB. After doing query_engine = index.as_query_engine(), I successfully query the data in Qdrant VB. I also tried to create the index with VectorStoreIndex.from_vector_store
and successfully queried the data in Qdrant VB.
Experiment 2: Use my own data that I have already stored in the Qdrant VB
client = QdrantClient(url=<qdrant_vb_endpoint>, api_key=os.getenv("QDRANT_CLOUD_API_KEY"))
I create the index with
VectorStoreIndex.from_vector_store
. After doing query_engine = index.as_query_engine(), I try to query the query_engine and it failed.
Does anyone have an idea of how to get it to work? Thanks!