You can get all the nodes from your first index like this:
- If it is a local vector index:
nodes = index.docstore.docs
- If you have used third party vector store then you will need to use the vector store client to fetch all the nodes from that store.
once you have all the nodes , simply insert those nodes into the second index.
for node in nodes:
index2.insert_nodes(node)