Hi everyone,
I’m currently working with Weaviate and I have a question regarding querying multiple indexes in one go.
Right now, I am using the following code to query a single index:
document_collection = client.collections.get("Document_snap_updated")
response = document_collection.query.near_vector(
near_vector=query_vector,
limit=2,
return_metadata=MetadataQuery(distance=True)
)
for o in response.objects:
print(o.properties)
print(o.metadata.distance)
This works perfectly for querying a single index. However, I would like to know if there is a way to query multiple indexes simultaneously. Ideally, I would like to do something like this:
Python
document_collection = client.collections.get("Document_1", "Document_2", "Document_3")
response = document_collection.query.near_vector(
near_vector=query_vector,
limit=2,
return_metadata=MetadataQuery(distance=True)
)
for o in response.objects:
print(o.properties)
print(o.metadata.distance)
Is there a built-in way to achieve this in Weaviate, or would I need to query each index separately and then merge the results manually? Any guidance or examples would be greatly appreciated.
Thanks in advance for your help!