A vector index turns a haystack of document representations into a searchable structure: instead of scanning every document, a question-answering system can retrieve likely matches and pass them to a reader. In practice, the index sits between stored documents and retrieval. section 10.3.9
A Haystack workflow builds the index incrementally:
- Convert source lines into Haystack Document objects containing titles, text, and metadata. section 10.3.9
- Write those documents to a DocumentStore, such as FAISSDocumentStore, with embeddings enabled. section 10.3.9
- Use an EmbeddingRetriever to update document embeddings and save the resulting Faiss-backed index. section 10.3.9
- Connect the retriever to a reader in a Haystack pipeline so retrieved passages can support extractive answers. section 10.3.9
Choosing a Faiss index
The default Flat index favors the most accurate results and highest recall, but consumes substantial RAM and CPU. HNSW or IVF with Flat can be alternatives when resources are constrained. section 10.3.9
Listing 10.19 Initializing a document store
>>> from haystack.document_stores import FAISSDocumentStore >>> document_store = FAISSDocumentStore( ... return_embedding=True) #1 >>> document_store.write_documents(documents)
Inspect the concrete initialization and document-writing step that creates the searchable store. section 10.3.9







