# Fetching vector ids (1M+ vectors)

**URL:** <https://community.pinecone.io/t/fetching-vector-ids-1m-vectors/2671>\
**Category:** Support\
**Created:** [July 15, 2023, 1:24am UTC](https://community.pinecone.io/t/fetching-vector-ids-1m-vectors/2671 "2023-07-15T01:24:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nsartor](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/nsartor/32/835_2.png) [@nsartor](https://community.pinecone.io/u/nsartor)\
**Post date:** [July 19, 2023, 5:37pm UTC](https://community.pinecone.io/t/fetching-vector-ids-1m-vectors/2671/2 "2023-07-19T17:37:11Z")

</div>

> [@How to retrieve list of IDs in an index](https://community.pinecone.io/t/how-to-retrieve-list-of-ids-in-an-index/380/11):
>
> It is still pretty ridiculous that we have to do this, but here is a workaround: import numpy as np def get\_ids\_from\_query(index,input\_vector): print("searching pinecone...") results = index.query(vector=input\_vector, top\_k=10000,include\_values=False) ids = set() print(type(results)) for result in results['matches']: ids.add(result['id']) return ids def get\_all\_ids\_from\_index(index, num\_dimensions, namespace=""): num\_vectors = index.describe\_index\_stats()["namespaces"][namesp…

Something still hacky, but would take definitely less time to go through all the is records is something like this.

I suggested a structured approach, but the random outperforms.

---

_[View the full topic](https://community.pinecone.io/t/fetching-vector-ids-1m-vectors/2671)._
