How to Migrate from Elasticsearch to Vespa: A Step-by-Step Guide
Vespa.ai

How to Migrate from Elasticsearch to Vespa: A Step-by-Step Guide

This brief outlines seven steps for migrating from Elasticsearch to Vespa, from assessing your existing deployment and developing a proof of concept to benchmarking, relevance testing, and production cutover.

Vespa.ai7 minute read

Introduction


Elasticsearch has grown into a widely used search and analytics engine, supporting diverse enterprise applications beyond full-text search. However, as data volumes expand and AI-driven applications demand lower latency and greater scalability, organizations face increasing challenges with Elasticsearch’s performance, operational complexity, and infrastructure costs.

Vespa brings retrieval, multi-phase ranking, and machine-learned inference together in a single engine, giving organizations greater control over relevance, performance, and infrastructure efficiency. Performance benchmarks and real-world deployments demonstrate the benefits of this approach, including higher query throughput per CPU core, faster real-time updates, and reduced infrastructure requirements. While migrating from Elasticsearch to Vespa requires careful planning, Vespa’s technical documentation and migration partners such as Searchplex help streamline the process.

This brief outlines seven steps for migrating from Elasticsearch to Vespa, from assessing your existing deployment and developing a proof of concept to benchmarking, relevance testing, and production cutover.

Quote from Vinted about migrating to Vespa.ai:

“The migration was a roaring success. We managed to cut the number of servers we use in half (down to 60). The consistency of search results has improved since we’re now using just one deployment (or cluster, in Vespa terms) to handle all traffic. Search latency has improved by 2.5x and indexing latency by 3x. The time it takes for a change to be visible in search has dropped from 300 seconds (Elasticsearch’s refresh interval) to just 5 seconds. Our search traffic is stable, the query load is deterministic, and we’re ready to scale even further.”

Why teams move from Elasticsearch to Vespa


Elasticsearch was built on Apache Lucene for full-text search and analytics. Vector search, hybrid ranking, and frequent updates expose limits in that design as data volumes and traffic grow.

Vector search struggles at scale

Lucene stores data in immutable segments, each with its own HNSW vector graph. Updates and segment merges force graphs to be rebuilt, causing resource spikes, and every query must traverse a graph in each segment, which makes tail latency unpredictable under load.

Hybrid search multiplies the cost

Hybrid queries run keyword and vector retrieval separately across every segment, then merge the results with rank fusion. CPU and I/O costs grow with data volume and concurrency, and the merged results aren’t ranked together with your business signals.

Advanced ranking increases architectural complexity

Custom scoring and reranking often end up in a separate rerank service and ML infrastructure. That service loses context the engine had, such as index-time features, scoring signals, and query-time statistics, and adds operational complexity.

Real-time updates introduce indexing overhead

Elasticsearch relies on periodic index refreshes to make new and updated documents searchable. Increasing refresh frequency can add indexing overhead and compete with query processing for resources, making it harder to balance data freshness, search performance, and infrastructure efficiency in applications with frequent updates.

How Vespa handles these workloads


Vespa runs retrieval, multi-phase ranking, and model inference in one engine, close to the data. This integrated architecture enables efficient vector and hybrid search while combining keyword, vector, and business signals such as price, stock, and promotions in a single query. Attribute updates, such as price changes or back-in-stock flags, are visible to queries immediately.

Vespa’s native multi-phase rankingA search query leads into Vespa. Inside Vespa, retrieval (lexical, vector, and structured matching) comes first, then the first phase (ranking), the second phase (re-ranking) and the global phase (final re-ranking), in that order, with ML models under the three ranking phases.Search queryVespaRetrieval Lexical, vector, and structured matchingFirst phase RankingSecond phase Re-rankingGlobal phase Final re-rankingML modelsVespa’s native multi-phase rankingA search query leads into Vespa. Inside Vespa, retrieval (lexical, vector, and structured matching) comes first, then the first phase (ranking), the second phase (re-ranking) and the global phase (final re-ranking), in that order, with ML models under the three ranking phases.Search queryVespaRetrieval Lexical, vector, and structured matchingFirst phase RankingSecond phase Re-rankingGlobal phase Final re-rankingML models
Figure 1. Vespa’s native multi-phase ranking. A search query leads into Vespa, where retrieval (lexical, vector, and structured matching) comes first, then the first phase (ranking), the second phase (re-ranking) and the global phase (final re-ranking), with ML models under the three ranking phases.

In our published benchmark on one million e-commerce products, Vespa delivered 8.5× higher throughput per CPU core for hybrid queries, up to 12.9× for vector queries, and 6.5× for lexical queries, with about 4× more efficient in-place updates (Vespa 8.427.7 and Elasticsearch 8.15.2, November 2024).

Steps in migrating from Elasticsearch to Vespa


Beginning with an assessment of the existing Elasticsearch deployment, a phased migration approach helps organizations minimize risk and transition production workloads in a controlled rollout. Unlike a Big Bang migration, which can lead to workload overload, unforeseen failures, and degraded search performance, a step-by-step transition enables teams to validate performance, refine their implementation, and maintain fallback options before fully migrating production traffic.

Step 1: Audit your current setup

Before building anything, audit your Elasticsearch deployment to understand what needs to be migrated and how success will be measured. Document data models and mappings, query patterns, business logic in scripts and ingest pipelines, ranking requirements, update rates, and dependencies on Elasticsearch-specific functionality. Establish baseline metrics for performance and cost. The audit defines what the proof of concept must reproduce and the metrics it must beat.

Step 2: Define migration ownership and responsibilities

Assign clear ownership for the migration across application development, search engineering, infrastructure, and testing. The size and composition of the team will depend on the complexity of the existing deployment. Organizations new to Vespa can bring in a migration partner to fill gaps in expertise. This team should define key focus areas for the migration, including:

  • Architecture: Designing a scalable and performant system with the new search engine.

  • Infrastructure: Planning server deployment, resource allocation, and load balancing.

  • Indexing: Optimizing real-time data ingestion, ensuring minimal latency.

  • Querying: Fine-tuning search logic, ranking models, and hybrid search capabilities.

  • Metrics & Performance Testing: Monitoring system behavior and validating performance under production-like conditions.

Step 3: Develop and iterate a proof of concept

Migration begins with developing a proof of concept (PoC) and refining it through iterations until it meets functional, performance, and relevance requirements. This typically involves defining a Vespa application package with a schema that fits the data model and ingesting a representative sample of production data, along with a representative sample of production queries to test against. The open-source migrate2vespa CLI can accelerate this process by assessing existing Elasticsearch or OpenSearch mappings and generating a starter Vespa application package, with optional sample data and queries. For a practical walkthrough, see Searchplex’s migration tutorial. Tools like Logstash can assist with data ingestion. During this phase, organizations may need to adjust the schema and map Elasticsearch concepts to Vespa, using resources like the Vespa glossary to guide the transition.

Once data is available in Vespa, queries need to be translated as well. Vespa offers multiple ways to express queries, similar to Elasticsearch. Those using SQL or ES|QL in Elasticsearch may find Vespa’s YQL a natural alternative, while applications built on Elasticsearch’s JSON Query DSL can translate their query logic using Vespa's query API and select syntax, where appropriate. Aggregation queries can be adapted using Vespa’s grouping feature, which supports nested structures like Elasticsearch. Business logic held in Elasticsearch scripts, ingest pipelines, or application code needs translating too, typically into Vespa ranking expressions, document processors, or searchers.

Once functional equivalence is achieved, the next step is scaling the Vespa cluster to accommodate the full dataset and conducting performance testing. Unlike Elasticsearch, which relies on a fixed number of physical shards, Vespa distributes data across many virtual buckets. This approach simplifies scaling, eliminating the need to manually manage sharding when adding or removing nodes.

Performance optimization typically involves gradually increasing query load, monitoring key metrics, and adjusting cluster size. Vespa’s performance guides provide additional insights on capacity planning, tuning, and best practices for optimizing efficiency at scale.

Step 4: Run scaled benchmarks and stress tests

To ensure the new system can handle real-world traffic loads, provision Vespa and Elasticsearch clusters with the same dataset and query set, then benchmark and stress test both. Depending on your scale, test at 10%, 25%, and 50% of production data. This includes:

  • Measuring search quality against a golden set of queries, using metrics such as top-K recall.

  • Baselining node, memory, and CPU use for each system on shared dashboards.

  • Measuring query throughput, indexing speed, and latency under high load.

  • Scaling up traffic in controlled increments to identify potential bottlenecks.

  • Optimizing system configurations to maximize efficiency and stability.

Step 5: Implement a shadow traffic strategy

Before making any changes visible to users, implement a shadow traffic strategy. This involves sending live queries simultaneously to both Elasticsearch and Vespa and comparing results in real-time. Ensure both systems have comparable datasets and account for differences in data freshness when evaluating search results.

Shadow traffic allows engineers to:

  • Identify discrepancies in search behavior between the two systems.

  • Fine-tune ranking and indexing logic to ensure consistency.

  • Validate infrastructure performance before exposing users to the new system.

Step 6: Conduct A/B testing for search relevance

Once shadow testing confirms the system's technical stability, A/B testing should be used to evaluate search relevance. Users are gradually exposed to the new search engine in controlled experiments, allowing search teams to:

  • Measure user engagement, satisfaction, and relevance metrics.

  • Fine-tune ranking algorithms and query execution.

  • Iterate through multiple test cycles to match or exceed the previous system's quality.

Step 7: Gradual cutover and full migration

After refining search quality and validating performance, the final migration should be a gradual switch rather than an immediate transition. Promote each release through development, staging, and production environments, and keep Elasticsearch running in parallel so you can roll back quickly. This ensures:

  • A fallback option remains available if any unforeseen issues arise.

  • Load balancing is adjusted to prevent system strain.

  • Search performance remains stable as traffic progressively shifts to the new search engine.

  • Monitoring continues at each step, so regressions are caught before more traffic moves.

What to expect


A migration is a real project, and two challenges come up most often:

  • Learning curve: Vespa’s application packages, schemas, and rank profiles work differently from Elasticsearch, so teams need time to build operational understanding.

  • Self-hosting complexity: running Vespa yourself takes more effort if you need multi-tenancy, multi-node clusters, or dynamic scaling.

Two options reduce that risk. Vespa Cloud takes care of operations, scaling, and upgrades, and an experienced migration partner shortens the learning curve.

Summary


Migrating between technologies may seem like a complex undertaking, but by following this structured, multi-phase migration process, the transition can be manageable and low-risk.

Ready to evaluate Vespa as an Elasticsearch alternative? Explore the customer stories in the Additional Resources section below to learn how other organizations have successfully migrated to Vespa. Then, get started with a free trial of Vespa Cloud to build a proof of concept or work with an experienced migration partner to assess your requirements and plan your transition.

Additional resources


Customer migration stories

  • Kleinanzeigen: Moved from Elasticsearch to Vespa for personalized recommendations, using advanced ranking to improve listing discovery.

  • Vinted: Replaced Elasticsearch with Vespa, cutting its server count in half while improving search performance and indexing speed.

  • Splore: Moved from Elasticsearch to Vespa with Searchplex to add hybrid search and cut search latency.

  • GEM: Migrated from Elasticsearch to Vespa with Searchplex to enable image-based search alerts that its existing infrastructure couldn’t support.

  • Podcast: Vespa Voice with Vinted on replacing Elasticsearch with Vespa.

Migration guides and technical resources