# Vespa

> One engine for vector, keyword, and structured search with built-in ranking at scale

- Category: Retrieval & Knowledge (RAG) / Rerank, Search & Hybrid
- Language: Java, C++
- Licence: Apache-2.0
- Repository: https://github.com/vespa-engine/vespa
- Website: https://vespa.ai
- Canonical page: https://ai-tldr.dev/tools/vespa/

## In short

Vespa is an open-source engine for storing, searching, and ranking large amounts of data at serving time. It handles vectors, tensors, text, and structured fields in one place, so you can run vector search, keyword (BM25) search, and filters on structured data within a single query. It sits in the Rerank, Search & Hybrid category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Java, C++ and licensed Apache-2.0.

## Overview

Vespa is an open-source engine for storing, searching, and ranking large amounts of data at serving time. It handles vectors, tensors, text, and structured fields in one place, so you can run vector search, keyword (BM25) search, and filters on structured data within a single query.

It is built for teams who need low-latency retrieval over data that keeps changing, often returning results in under 100 milliseconds while the corpus is updated. Vespa distributes data across multiple nodes and evaluates queries in parallel, which is why it is used on internet services that handle hundreds of thousands of queries per second.

In the RAG and retrieval space, Vespa fits the hybrid-search and reranking role: instead of bolting a vector index onto a separate keyword index, it does both natively and lets you express custom ranking, including machine-learned models, as part of the application config.

## What it does

- Combines vector, tensor, keyword (BM25), and structured search in a single query
- Built-in ranking framework, including evaluation of machine-learned models at serving time
- Designed for low-latency retrieval, often under 100 ms, over continuously changing data
- Scales horizontally across multiple nodes with high availability and parallel query evaluation
- Vespa CLI plus a JSON document/query API for feeding data and running searches
- Run locally with Docker or deploy to the managed Vespa Cloud service

## Getting started

You do not need to build Vespa from source to use it. The quickest path is the Vespa CLI with a local Docker container running a sample application.

1. Install the Vespa CLI

   Install the CLI with Homebrew, or download a build from the GitHub releases page if Homebrew is not available.

```bash
brew install vespa-cli
```

2. Start Vespa locally with Docker

   Point the CLI at a local target, then run the Vespa container, publishing the query (8080) and config (19071) ports.

```bash
vespa config set target local
docker run --detach --name vespa --hostname vespa-container \
  --publish 8080:8080 --publish 19071:19071 \
  vespaengine/vespa
```

3. Deploy a sample app and feed data

   Clone the album-recommendation sample application, deploy it, and feed the included documents.

```bash
vespa clone album-recommendation myapp && cd myapp
vespa deploy --wait 300 ./app
vespa feed dataset/documents.jsonl
```

4. Run a query

   Query the indexed documents with the CLI using Vespa's SQL-like query syntax.

```bash
vespa query "select * from music where album contains 'head'"
```

## When to use it

- Hybrid search that blends dense vector similarity with BM25 keyword matching and structured filters in one query
- Retrieval and reranking backend for a RAG pipeline over a large, frequently updated corpus
- Recommendation and personalization systems that evaluate machine-learned ranking models at serving time
- Low-latency search over hundreds of thousands of queries per second across a distributed, multi-node cluster
