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

AstraDocumentStore

Store and retrieve documents using DataStax Astra DB, a serverless vector database built on Apache Cassandra.

Key Features

  • Stores documents in Astra DB with native vector search support.
  • Serverless architecture that scales automatically with usage.
  • Supports cosine, dot product, and Euclidean similarity functions.
  • Supports namespace isolation for multi-tenant use cases.
  • Configurable duplicate handling policies.

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. Create an Astra DB instance and obtain your API endpoint and application token from the Astra DB console.
  2. Create secrets with your Astra credentials. For instructions, see Create Secrets:
    • ASTRA_DB_API_ENDPOINT: Your Astra DB API endpoint.
    • ASTRA_DB_APPLICATION_TOKEN: Your Astra DB application token.
  3. Configure the AstraDocumentStore in your pipeline YAML.

Source Code

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

Usage Examples

Basic Configuration

  AstraDocumentStore:
type: haystack_integrations.document_stores.astra.document_store.AstraDocumentStore
init_parameters:
api_endpoint:
type: env_var
env_vars:
- ASTRA_DB_API_ENDPOINT
strict: true
token:
type: env_var
env_vars:
- ASTRA_DB_APPLICATION_TOKEN
strict: true
collection_name: haystack_docs
embedding_dimension: 768
similarity: cosine

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
api_endpointSecretSecret.from_env_var("ASTRA_DB_API_ENDPOINT")The Astra DB API endpoint URL.
tokenSecretSecret.from_env_var("ASTRA_DB_APPLICATION_TOKEN")The Astra DB application token.
collection_namestrdocumentsThe name of the Astra DB collection to store documents in.
embedding_dimensionint768The dimensionality of document embeddings. Must match your embedding model's output.
duplicates_policyDuplicatePolicyDuplicatePolicy.NONEHow to handle duplicate documents. One of NONE, SKIP, OVERWRITE, or FAIL.
similaritystrcosineThe vector similarity metric. One of cosine, dot_product, or euclidean.
namespaceOptional[str]NoneThe Astra DB namespace (keyspace) to use.