# Vearch

> A cloud-native distributed vector database with hybrid vector and scalar search

- Category: Retrieval & Knowledge (RAG) / Vector Databases
- Language: Go, C++, Python
- Licence: Apache-2.0
- Repository: https://github.com/vearch/vearch
- Website: https://vearch.github.io
- Canonical page: https://ai-tldr.dev/tools/vearch/
- Updated: 2026-02-04

## In short

Vearch is a cloud-native distributed vector database for similarity search over embedding vectors in AI applications. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Go, C++, Python and licensed Apache-2.0. To get started: deploy on Kubernetes with Helm.

## Overview

Vearch is a cloud-native distributed vector database for similarity search over embedding vectors in AI applications. It combines vector search with scalar filtering in the same query, so you can ask for the nearest neighbours of an embedding while restricting results by ordinary fields such as a name or a number. The project describes its goal as searching millions of objects in milliseconds, with replication and elastic scale-out for reliability.

A Vearch cluster is split into three roles. The Master handles schema management, cluster-level metadata and resource coordination. The Router exposes the RESTful API — upsert, delete, search and query — routes each request and merges the partial results. PartitionServers host the document partitions with Raft-based replication, and each one runs Gamma, Vearch's core vector search engine built on faiss, which stores, indexes and retrieves both the vectors and the scalar fields.

Data is organised as databases containing spaces, where a space is a schema of typed fields — strings, integers and fixed-dimension vectors, each with its own index. Beyond the REST API there are official Python, Go, Java and Rust SDKs, and integrations that plug Vearch in as the vector store for LangChain, LlamaIndex, Langchaingo and LangChain4j. The paper the project asks researchers to cite, from 2019, describes a real-time visual search system built on the JD e-commerce platform.

## What it does

- Hybrid search: nearest-neighbour vector search combined with scalar filtering in one request
- Distributed architecture with separate Master, Router and PartitionServer roles
- Raft-based replication of partitions and elastic scale-out
- Gamma, a faiss-based engine that stores, indexes and retrieves vectors and scalars
- RESTful API plus Python, Go, Java and Rust SDKs
- Vector-store integrations for LangChain, LlamaIndex, Langchaingo and LangChain4j

## Getting started

Vearch runs as a server cluster — deploy it on Kubernetes with Helm or locally with Docker Compose — and you talk to its Router over REST or through an SDK. The steps below follow the README and the Python SDK README.

1. Deploy on Kubernetes with Helm

   The project publishes a Helm chart repository.

```bash
helm repo add vearch https://vearch.github.io/vearch-helm
helm repo update && helm install my-release vearch/vearch
```

2. Or run it with Docker Compose

   From a clone of the repository, copy a config into the cloud directory and pick standalone or cluster mode.

```bash
git clone https://github.com/vearch/vearch.git && cd vearch

# Standalone mode
cd cloud && cp ../config/config.toml .
docker-compose --profile standalone up -d

# Cluster mode (instead of the above)
# cd cloud && cp ../config/config_cluster.toml .
# docker-compose --profile cluster up -d
```

3. Install the Python SDK and connect

   Point the client at your Router address.

```bash
pip3 install pyvearch
```

4. Create a database and a space

   A space is a schema of typed fields; here two scalar fields with scalar indexes and a 512-dimension vector field with a flat inner-product index.

```python
from vearch.core.vearch import Vearch
from vearch.config import Config
from vearch.schema.field import Field
from vearch.schema.space import SpaceSchema
from vearch.utils import DataType, MetricType, VectorInfo
from vearch.schema.index import FlatIndex, ScalarIndex

config = Config(host="your router path", token="secret")
vc = Vearch(config)

vc.create_database("database_test")

book_name = Field("book_name", DataType.STRING, desc="the name of book", index=ScalarIndex("book_name_idx"))
book_num = Field("book_num", DataType.INTEGER, desc="the num of book", index=ScalarIndex("book_num_idx"))
book_vector = Field("book_character", DataType.VECTOR, FlatIndex("book_vec_idx", MetricType.Inner_product), dimension=512)
space_schema = SpaceSchema("book_info", fields=[book_name, book_num, book_vector])

vc.create_space("database_test", space_schema)
```

5. Upsert documents and search

   Insert a document, run a vector search, then query by scalar filter.

```python
import random
from vearch.filter import Filter, Condition, FieldValue

data = [{"book_name": "Write", "book_num": 7, "book_character": [random.uniform(0, 1) for _ in range(512)]}]
ret = vc.upsert("database_test", "book_info", data)
document_ids = ret.get_document_ids()

vi = VectorInfo("book_character", [random.uniform(0, 1) for _ in range(512)])
ret = vc.search("database_test", "book_info", vector_infos=[vi], limit=7)
print(ret.documents)

filters = Filter(operator="AND", conditions=[
    Condition(operator=">", fv=FieldValue(field="book_num", value=0)),
    Condition(operator="IN", fv=FieldValue(field="book_name", value=["Write"])),
])
ret = vc.query("database_test", "book_info", filter=filters)
print(ret.documents)
```

## When to use it

- Reach for it when you need a self-hosted vector database that scales out across nodes with replicated partitions
- Reach for it when similarity search has to be combined with scalar filters on ordinary fields in the same query
- Reach for it as the vector store behind a LangChain, LlamaIndex, Langchaingo or LangChain4j RAG pipeline
- Reach for it to build a large-scale visual search system — the README says Vearch can back a visual search system indexing billions of images, with a separate image-retrieval plugin for object detection and feature extraction

## Version history

- 2026-02-04 v3.5.9: Added real-time searching, slow-search isolation, a memory circuit breaker that kills slow queries, pagination, search by partition name, GPU IVFPQ index search and Prometheus metrics for the Master and PartitionServers.
