Skip to content

Backends

Medha supports nine vector backends. Choose based on your infrastructure, persistence requirements, and scale.


Comparison

Backend Use Case Persistence Setup Cloud-native Extra
memory Dev/testing No None No built-in
qdrant General production Yes Docker/Cloud Yes [qdrant]
pgvector Existing PostgreSQL Yes Postgres + extension No [pgvector]
elasticsearch Search-heavy stacks Yes ES 8.x Yes [elasticsearch]
vectorchord High-perf Postgres Yes Postgres + extension No [vectorchord]
chroma Rapid prototyping Optional None/Docker No [chroma]
weaviate Knowledge graph Yes Docker/Cloud Yes [weaviate]
redis Low-latency cache Optional Redis Stack Yes [redis]
azure_search Azure ecosystem Yes Managed Yes [azure-search]
lancedb Embedded/serverless Yes None Optional [lancedb]

memory — In-Memory

Install

Built-in. No extra dependencies required.

pip install medha-archai

The default backend. Stores all vectors in a Python dict keyed by entry ID. Data is lost when the process exits. Ideal for unit tests and local development.

from medha import Settings

settings = Settings(backend_type="memory")

qdrant — Qdrant

Install

pip install "medha-archai[qdrant]"

Qdrant is the recommended production backend. It supports both an in-process mode (no server) and a full client-server deployment with gRPC/REST.

from medha import Settings

# Local Docker instance
settings = Settings(
    backend_type="qdrant",
    qdrant_host="localhost",
    qdrant_port=6333,
)

# Qdrant Cloud
settings = Settings(
    backend_type="qdrant",
    qdrant_url="https://your-cluster.qdrant.tech",
    qdrant_api_key="your-api-key",
)

Start a local Qdrant instance with Docker:

docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant

pgvector — PostgreSQL + pgvector

Install

pip install "medha-archai[pgvector]"

Uses the pgvector extension for PostgreSQL. Best choice if you already run Postgres and want to consolidate infrastructure.

from medha import Settings

settings = Settings(
    backend_type="pgvector",
    pg_dsn="postgresql://user:password@localhost:5432/mydb",
)

Install the extension in your database:

CREATE EXTENSION IF NOT EXISTS vector;

elasticsearch — Elasticsearch

Install

pip install "medha-archai[elasticsearch]"

Uses Elasticsearch 8.x dense vector fields and kNN search. Suitable for stacks already using Elasticsearch for full-text search.

from medha import Settings

settings = Settings(
    backend_type="elasticsearch",
    es_url="http://localhost:9200",
    # es_api_key="..." for Elastic Cloud
)

vectorchord — VectorChord

Install

pip install "medha-archai[vectorchord]"

VectorChord is a high-performance vector extension for PostgreSQL using IVF-PQ indexing. Recommended over pgvector for large-scale deployments (>1M entries).

from medha import Settings

settings = Settings(
    backend_type="vectorchord",
    pg_dsn="postgresql://user:password@localhost:5432/mydb",
)

chroma — Chroma

Install

pip install "medha-archai[chroma]"

Chroma can run in-process (ephemeral) or as a server (persistent). Excellent for rapid prototyping and notebook environments.

from medha import Settings

# In-process (ephemeral)
settings = Settings(backend_type="chroma")

# HTTP client (persistent)
settings = Settings(
    backend_type="chroma",
    chroma_host="localhost",
    chroma_port=8000,
)

weaviate — Weaviate

Install

pip install "medha-archai[weaviate]"

Weaviate is a knowledge-graph-oriented vector database with built-in schema management. Good for teams already using Weaviate or who need rich object properties alongside vectors.

from medha import Settings

settings = Settings(
    backend_type="weaviate",
    weaviate_url="http://localhost:8080",
    # weaviate_api_key="..." for Weaviate Cloud
)

redis — Redis Stack

Install

pip install "medha-archai[redis]"

Uses Redis Stack's RediSearch module for vector similarity search. Delivers the lowest latency of any networked backend (< 1 ms P99 for small indexes). Persistence depends on your Redis configuration (RDB/AOF).

from medha import Settings

settings = Settings(
    backend_type="redis",
    redis_url="redis://localhost:6379",
)

Note

The redis backend uses Redis Stack, not vanilla Redis. Ensure RediSearch is available in your deployment.


Install

pip install "medha-archai[azure-search]"

Fully managed vector search service on Azure. Recommended for teams running workloads in Azure that want zero infrastructure management.

from medha import Settings

settings = Settings(
    backend_type="azure_search",
    azure_search_endpoint="https://your-service.search.windows.net",
    azure_search_api_key="your-admin-key",
)

lancedb — LanceDB

Install

pip install "medha-archai[lancedb]"

LanceDB is an embedded vector database that writes directly to disk (local or cloud object storage). No server required, making it ideal for serverless deployments or single-machine applications that need persistence.

from medha import Settings

# Local filesystem
settings = Settings(
    backend_type="lancedb",
    lancedb_uri="./my_cache.lancedb",
)

# S3 / GCS / Azure Blob
settings = Settings(
    backend_type="lancedb",
    lancedb_uri="s3://my-bucket/cache",
)