# Querying Multiple Indexes in Weaviate v4

**URL:** <https://forum.weaviate.io/t/querying-multiple-indexes-in-weaviate-v4/3977>\
**Category:** Support\
**Created:** [September 4, 2024, 7:23pm UTC](https://forum.weaviate.io/t/querying-multiple-indexes-in-weaviate-v4/3977 "2024-09-04T19:23:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abg79](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Abg79](https://forum.weaviate.io/u/Abg79)\
**Post date:** [September 4, 2024, 7:23pm UTC](https://forum.weaviate.io/t/querying-multiple-indexes-in-weaviate-v4/3977/1 "2024-09-04T19:23:56Z")

</div>

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:

```auto
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

```auto
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!

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [September 4, 2024, 8:42pm UTC](https://forum.weaviate.io/t/querying-multiple-indexes-in-weaviate-v4/3977/2 "2024-09-04T20:42:14Z")

</div>

hi @Abg79 !

You cannot perform one query on multiple indexes.

What you can do is to use, that can be closer to what you want, depending on your use case, is [ref2vec-centroid](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/ref2vec-centroid)

Here we have a blog post double clicking on that:

> **[What is Ref2Vec and why you need it for your recommendation system | Weaviate](https://weaviate.io/blog/ref2vec-centroid)**
>
> Weaviate introduces Ref2Vec, a new module that utilises Cross-References for Recommendation!

Another option would be having multiple vectors per one object (named vectors) and doing a multi target search:

> **[Multiple target vectors | Weaviate](https://weaviate.io/developers/weaviate/search/multi-vector)**
>
> Multiple target vector search uses a single query to search multiple-target vectors. Weaviate searches the target vectors concurrently and automatically combines the results.

Of course, this may or may not fit your usecase.

Let me know if this helps.

Thanks!
