Find answers from the community

Updated last week

how do I get all the nodes from the vector store I store all the nodes via a pipeline?

@kapa.ai how do I get all the nodes from the vector store I store all the nodes via a pipeline?
k
2 comments
Please stand by @cmosguy as I search the knowledge base. I normally take about 15 seconds or so. :wave:
----------------------
To retrieve all the nodes from a vector store where you've stored nodes using a pipeline, you can use the VectorStoreIndex class in LlamaIndex. Here's how you can do it:

  1. First, create a VectorStoreIndex from your vector store:
Plain Text
from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_vector_store(vector_store)


  1. Then, you can use the as_query_engine method to create a query engine, and set a high similarity_top_k value to retrieve all nodes:
Plain Text
query_engine = index.as_query_engine(similarity_top_k=10000)  # Set a high value to retrieve all nodes


  1. Finally, you can query for all documents:
Plain Text
response = query_engine.query("What documents do you see?")

print(response)
for node in response.source_nodes:
    print(node.get_text())


This approach will retrieve all the nodes from your vector store and print their content.

It's worth noting that the exact method might vary depending on the specific vector store you're using. The example above is based on the Redis vector store implementation shown in the Redis Ingestion Pipeline example.

If you need more control over the retrieval process or want to access the nodes directly, you might want to look into the specific methods provided by your vector store implementation. Some vector stores might have a get_nodes() method or similar that allows you to retrieve all nodes directly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord