Brute-force search over millions of vectors takes seconds per query. I tried IndexIVFFlat and got an error about istrained.

Find answers to your programming questions.
Brute-force search over millions of vectors takes seconds per query. I tried IndexIVFFlat and got an error about istrained.
index.search returns some IDs of -1, and I don't know how to get from the returned numbers back to my original documents.
With similaritysearchwithscore, the most relevant document has the lowest score. In another setup, all scores are high, even for unrelated text.
My embeddings are 1536 or 3072 dimensions. Storage and search are expensive, and some indexes have dimension limits. How can I make them smaller?
Re-embedding millions of documents is expensive. Can I map my old 768-dimensional vectors to the new model's 1024 dimensions?
torch.nn.functional.cosinesimilarity fails with a size or dimension error.
I used Hugging Face AutoModel to create embeddings. The output has an extra dimension, and every similarity function rejects it.
FAISS only has IndexFlatL2 and IndexFlatIP. My model's docs say to use cosine similarity. Which index should I use?