How do i list all the documents that have been inserted

I am trying to list all the documents that have been inserted with code like this:
def get_inserted_documents(index):
# Query with an empty embedding to retrieve all documents in the index
res = index.query(, top_k=1000) # Increase ‘top_k’ if you have more than 1000 documents
documents = [item[‘metadata’] for item in res[‘matches’]]
return documents
but i keep getting an error because the query vector is empty
is there another way to do this ?
thanks
ken tyler

Hi @kentyler,

Thanks for your question, and I’m sorry to hear you’re encountering this issue.

To perform your query, you can pass an “empty vector” as the first argument to the query method. Instead of an empty list, which is what you’re currently passing and what is causing the query to fail, you can create an empty vector like so:

[0.0] * 1536

Try passing that as your first argument and let us know how it goes.

I hope that is helpful!