Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

FAISSDocumentStore

Store and retrieve documents using FAISS (Facebook AI Similarity Search), a library for efficient vector similarity search. FAISSDocumentStore is suitable for small to medium-sized datasets where simplicity is preferred over distributed scalability.

Key Features

  • Stores document metadata in a local JSON file and embeddings in a FAISS index.
  • Supports a wide range of FAISS index types (for example, Flat, IVFFlat, HNSW).
  • Simple persistence: saves the FAISS index to a .faiss file and documents to a .json file.
  • No external database required — runs entirely in memory backed by local files.

Configuration

Add Workspace-Level Integration

  1. Click your profile icon and choose Settings.
  2. Go to Workspace>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in the current workspace.

Add Organization-Level Integration

  1. Click your profile icon and choose Settings.
  2. Go to Organization>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
  1. Drag the FAISSDocumentStore component onto the canvas from the Component Library.
  2. Configure the embedding_dim to match your embedding model's output dimension.
  3. Optionally set index_path to an existing .faiss index file to load a pre-built index.
  4. Set index_string to choose the FAISS index type (for example, Flat for exact search or IVFFlat for approximate search on larger datasets).

Source Code

To check this component's source code, open document_store.py in the Haystack Core Integrations repository.

Usage Examples

Basic Configuration

  FAISSDocumentStore:
type: haystack_integrations.document_stores.faiss.document_store.FAISSDocumentStore
init_parameters:
embedding_dim: 384
index_string: Flat

Loading an Existing Index

  FAISSDocumentStore:
type: haystack_integrations.document_stores.faiss.document_store.FAISSDocumentStore
init_parameters:
index_path: /path/to/my_index.faiss
embedding_dim: 384

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
index_pathOptional[str]NonePath to an existing .faiss index file to load. If None, creates a new index.
index_stringstrFlatThe FAISS index type string. Use Flat for exact search, IVFFlat or HNSW for approximate nearest neighbor search on larger datasets.
embedding_dimint768The dimensionality of document embeddings. Must match your embedding model's output.