liveBook · Manning

Vector index

As explained in Natural Language Processing in Action, Second Edition

Vector search indexing is the process of organizing numerical vector representations so that semantically similar items can be retrieved efficiently.

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

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains document conversion, store initialization, embedding updates, and Faiss index choices, but stops short of algorithm internals.
Examples
Uses AsciiDoc manuscript lines, Haystack Documents, FAISSDocumentStore, and Faiss Flat, HNSW, and IVF options.
What you can do after
Build it from scratch with Haystack by storing documents, updating embeddings, and saving a Faiss-backed index.
How it connects
Connects document stores with embeddings, retrievers, readers, and extractive question answering.

Also explained in

Compare how 8 books explain vector index →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.