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
.faissfile and documents to a.jsonfile. - No external database required — runs entirely in memory backed by local files.
Configuration
Add Workspace-Level Integration
- Click your profile icon and choose Settings.
- Go to Workspace>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in the current workspace.
Add Organization-Level Integration
- Click your profile icon and choose Settings.
- Go to Organization>Integrations.
- Find the provider you want to connect and click Connect next to them.
- Enter the API key and any other required details.
- Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
- Drag the
FAISSDocumentStorecomponent onto the canvas from the Component Library. - Configure the
embedding_dimto match your embedding model's output dimension. - Optionally set
index_pathto an existing.faissindex file to load a pre-built index. - Set
index_stringto choose the FAISS index type (for example,Flatfor exact search orIVFFlatfor 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:
| Parameter | Type | Default | Description |
|---|---|---|---|
index_path | Optional[str] | None | Path to an existing .faiss index file to load. If None, creates a new index. |
index_string | str | Flat | The FAISS index type string. Use Flat for exact search, IVFFlat or HNSW for approximate nearest neighbor search on larger datasets. |
embedding_dim | int | 768 | The dimensionality of document embeddings. Must match your embedding model's output. |
Related Information
Was this page helpful?