Migrating Elasticsearch dense_vector fields to OpenSearch k-NN vectors

Migration Assistant can convert dense_vector mappings to knn_vector during metadata migration, but dimensions, engine settings, application queries and recall need planned work. This page explains what moves, what does not, and how to run the cutover.

On this page

How do you move Elasticsearch dense_vector search to OpenSearch k-NN?

Teams that run vector search in Elasticsearch and need to move both the index and its queries to self-hosted OpenSearch face a two-part job. Migration Assistant converts Elasticsearch dense_vector mappings to OpenSearch knn_vector mappings during the metadata migration, but the application may still need query changes afterwards, and recall must be tested before cutover. Treat the mapping conversion as the start of the work, not the finish.

The effort is best described qualitatively. The metadata step is usually the smaller part, while the application query rewrite and recall testing take more care. Scope depends on the number of indices that hold vectors, the dimensions in use, the query patterns (pure k-NN, filtered k-NN, or hybrid queries that combine vectors with keyword scoring) and the source version. Confirm each of these in your own environment before you ask for a quote, because a single large index with filtered queries can take more planning than several small indices with plain similarity search.

Start by inventorying every dense_vector field, its dims value, its similarity setting and every query that reads it, including script-based scoring. Then decide the target engine and space type for each field, since the converted mapping and the query syntax both depend on those choices. Ask your implementation partner to show the converted mappings and a sample of rewritten queries for one index before the full run. Confirm the target OpenSearch version and the k-NN plugin behavior for that version against the OpenSearch docs for this conversion, since the supported mapping options are the boundary of what converts automatically.

Recall testing is the step most often skipped. Build a labeled set of queries with known good results from your current Elasticsearch cluster, run the same queries against OpenSearch with the converted mappings, and compare the top results. Agree on the acceptable recall loss and on who signs it off before the cutover window is booked. Any difference you find should be traced to the engine, parameters or query rewrite, not accepted as a general variance.

Which dense_vector settings carry over to knn_vector, and which need a decision

This table compares Elasticsearch dense_vector mapping elements, vector values, similarity settings, filters and kNN queries with their OpenSearch knn_vector counterparts. Read the middle column as what Migration Assistant handles during metadata migration, and the last column as what your team or application must decide or change.

ElementMigration Assistant handles itDecision or change needed
Field type and dimension countConverts dense_vector mappings to knn_vector during metadata migrationConfirm the converted dimension value matches your embedding model output before indexing
Stored vector valuesCarried over through the document backfill, not through mapping conversionCheck that document counts and vector values match after backfill
Similarity or distance settingMapping conversion may not map every similarity option one to oneChoose the OpenSearch space type that matches your embedding model and recall target
Engine and method settingsNot chosen for you by the conversionSelect the k-NN engine and method, then confirm supported settings in the OpenSearch docs for your target version
Approximate versus exact searchNot a mapping element, so no automatic conversionDecide whether approximate k-NN meets your recall requirement, and test against exact results
kNN query syntax in the applicationNot rewritten by Migration AssistantRewrite client queries to the OpenSearch k-NN query form and retest result ordering
Filters combined with kNN queriesFilter fields in the mapping may convert, but filter behavior is not rewrittenVerify filter clauses and their placement in each rewritten query
Parameter names and supported valuesNot guaranteed to convert unchangedConfirm exact parameter names and supported settings against the OpenSearch documentation for your version

How vector mappings, data and queries move through the cutover

The flow starts on the source Elasticsearch cluster, where dense_vector indices hold the embeddings. Migration Assistant converts those mappings to knn_vector during metadata migration, then backfills the documents into the target OpenSearch cluster. The application query layer is where rewrites happen, and a parallel run compares results from both clusters before a recall test gate approves cutover. Check that the converted mappings, dimensions and engine settings match what the queries expect, and that recall holds on your own queries.

Vector mappings, backfilled documents and query rewrites flow through a recall gate before cutover.

Which documented paths move vector mappings and data

OpenSearch documents several ways to get Elasticsearch vector data into a new cluster, and they split the work differently. Mappings, data, and application query code are separate pieces, and each path leaves some of them to your team. Pick the path by checking what it moves before you plan the cutover.

Migration Assistant metadata migration

Migration Assistant can convert Elasticsearch dense_vector mappings into OpenSearch knn_vector mappings during the metadata phase. This covers the index mapping only, so the vector field definitions exist in the target before any documents arrive. Your team still reviews the converted dimensions, similarity settings, and engine choice, and rewrites application queries that assume Elasticsearch behavior. Confirm which source versions the conversion supports before you commit to this path, since the Migration Assistant documentation describes the transform and your source version determines whether it applies.

Transform docs

Snapshot and restore for data

Snapshot and restore copies index data, including the stored vector values, from a repository into the new cluster. It moves documents, not the query logic or the vector index settings you choose for OpenSearch. A restored index only gets the vector structures you define or that the metadata step creates, so check the mapping before restoring. This path fits when the source data is current, the repository is reachable from both clusters, and you can accept a write freeze or a backfill step for changes made after the snapshot.

Remote reindexing

Remote reindexing pulls documents from the source cluster into a target index you have already created, so the mapping and engine settings come from your design rather than from the source. This suits a vector index that needs a different dimension, method, or engine than Elasticsearch used. The trade-off is throughput, because every vector is read over the network and re-indexed, and the k-NN graph is rebuilt on the target. Your team owns the index definition, the batch sizing, and verification of document counts.

Manual mapping creation with reindex

You can write the OpenSearch knn_vector mapping by hand, then load data with a reindex or an application-side re-embed. This gives full control over the vector field type, dimension, and k-NN method settings, and it is the usual choice when the embedding model or similarity metric is changing too. The cost is that nothing is converted for you, so every field, analyzer, and access control rule must be recreated and tested. Plan this path when the vector schema is being redesigned, not only moved.

How application queries change when the field becomes knn_vector

Pure similarity search sends a query vector and asks for the nearest stored vectors. In Elasticsearch, this usually runs through a knn section or a script_score query over dense_vector fields. After the move, the field is a knn_vector and the query must use the k-NN query type that the OpenSearch k-NN documentation describes for your chosen version. The client therefore changes in three places: the request body, the parameters that control how many neighbors are returned, and the code that reads scores from the response.

  • Request body: Replace the Elasticsearch knn or script_score structure with the k-NN query syntax for the target version. Do not copy the body shape from Elasticsearch and expect it to run.
  • Result count: Confirm how the number of neighbors returned (k) relates to the number of results the client displays after pagination. Map these values explicitly in client code.
  • Score handling: Scores from the k-NN engine may not match the Elasticsearch values for the same vectors, so thresholds that filter on score need recalibration.
  • Tie ordering: Documents with equal or near-equal scores may appear in a different order, which affects tests that compare exact result lists.
  • Approximate results: Approximate search can miss some true nearest neighbors, so compare against an exact baseline during testing.

Check that every score threshold and result-count assumption in the client is written down and covered by a test before cutover.

How the vector migration runs with a parallel period and cutover

The sequence moves vector search from Elasticsearch dense_vector fields to OpenSearch knn_vector fields in gated stages, so each change is tested against a copy before live traffic depends on it. The result is a cutover that the team can verify and reverse until Elasticsearch is retired.

  1. Inventory every dense_vector index and query path

    List each index that contains a dense_vector field, along with its dimension count, similarity function, indexing options, and the application code, jobs and dashboards that query it. Include scripted score functions and any filters combined with kNN queries, since these determine what must be rewritten. The step is done when every vector field has an owner and a named query path, and the team agrees on the list of indices in scope.

  2. Build a pilot on a copy of the metadata

    Take a snapshot of one representative index and run Migration Assistant's metadata migration against a non-production OpenSearch cluster, so dense_vector mappings are converted to knn_vector mappings automatically. Review the generated mapping for dimensions, space type and engine settings, and compare it with what the application expects. The step is done when the pilot index loads, the mapping matches the review, and any conversion gaps are written down for the next gate.

  3. Decide engine and dimension settings

    Confirm the k-NN engine, space type and index-level settings for each field against the workload, and record the dimension count the embedding model produces. Check that the chosen OpenSearch version supports the engine and settings you plan to use, and confirm the details in the OpenSearch documentation for your release. The step is done when a signed-off settings record exists for each index, and any field that cannot be mapped cleanly has a decision on how to handle it.

  4. Rewrite and test application queries

    Update the application's Elasticsearch queries to the OpenSearch k-NN query syntax, and adjust any scripted scoring or filtering that the mapping conversion does not carry over. Run the rewritten queries against the pilot index in a test environment, and check that result counts, error handling and response formats match what the application expects. The step is done when the application's query test suite passes against the pilot and the rewritten query set is under version control.

  5. Backfill documents and verify counts

    Load the full document set and vectors into the OpenSearch indices, using snapshot restore or reindexing as the migration method allows for each index. Compare document counts and sample vector values between source and target for every index in scope. The step is done when counts and sampled records match for each index, and the team has recorded any documents that failed to load and how they were resolved.

  6. Run a parallel period and measure recall

    Send the same production queries to both the Elasticsearch path and the OpenSearch path, and store both result sets for comparison. Measure recall and ranking differences against a labeled query set, and review any queries where the top results differ in a way that affects users. The step is done when the comparison shows results the owners accept, and each difference has either been fixed or documented as an accepted change.

  7. Cut over and keep Elasticsearch for a rollback window

    Switch application traffic to the OpenSearch query path, using a configuration flag or routing change that can be reversed without a redeploy. Keep the Elasticsearch cluster and its indices running as a rollback option, and monitor error rates, latency and result quality during the window. The step is done when the agreed monitoring checks stay within the thresholds set before cutover.

  8. Decommission Elasticsearch after the rollback window

    Once the rollback window closes with no unresolved findings, remove the Elasticsearch query path from the application, archive a final snapshot for records, and shut down the cluster. Confirm that backup and access controls for any retained data still meet your policies. The step is done when the decommission record is signed off and Elasticsearch no longer serves any production traffic.

What drives cost and duration in a vector migration

This table lists the factors that change the effort and the recurring hosting cost of moving dense_vector fields to knn_vector. Read each row as a question to answer before asking for a quote, because most of these drivers are settled in the design phase rather than during the build. The migration itself is a one-time project, while the cluster that stores and searches the vectors keeps costing money every month after cutover.

DriverWhy it mattersWhat to ask for in a quote
Number of vector indices and document volumeEach index needs its own mapping conversion, backfill and validation, and total vector count sets the reindex and storage load.Itemized list of indices, document counts and vector sizes, with the backfill approach stated for each.
Embedding dimensionsHigher dimensions increase memory and disk per vector, which changes node sizing on the target cluster.Confirmed dimension per field and the sizing assumptions used for the target nodes.
Engine and memory planning on the targetThe knn_vector engine and its memory behavior determine whether the index fits in available RAM or needs more nodes.Engine choice per index, memory estimate method, and a sizing check against the target node specification.
Number of application query pathsEvery code path that builds a dense_vector script query must be rewritten and retested, so more paths mean more build and test work.Inventory of query paths, owning services, and the rewrite scope for each.
Hybrid or filtered searchCombining vector scores with keyword or metadata filters changes query structure and can change results and latency.Confirmed filter fields, hybrid ranking logic, and the test cases covering each combination.
Recall acceptance criteriaRecall targets set how many comparison runs, tuning cycles and sample sizes the team needs before sign-off.Written recall threshold, reference dataset, and the number of tuning rounds included in the fixed scope.
Source versionThe Elasticsearch version determines how metadata is read and which dense_vector settings must be checked for conversion.Confirmed source version, and a statement of any mapping settings that need manual review.
Parallel running periodRunning old and new search side by side adds hosting cost for both clusters and extra comparison work during that period.Length of the parallel period, who runs the comparison, and which cluster is billed or hosted for each phase.
Recurring cluster hostingThe vector cluster costs money every month after cutover for compute, memory, storage and backups.Ongoing support, upgrade and backup terms, stated separately from the one-time migration fee.

How to prove recall held after the move

Recall has to be measured, not assumed. Approximate nearest neighbor search returns results that depend on the engine, the index parameters and the query path, so a vector field that converts cleanly can still return a different top set in OpenSearch. Before cutover, build a fixed set of representative queries drawn from real search traffic, including common queries, rare queries and queries with known relevant documents. For each query, record the top results from the Elasticsearch cluster and the OpenSearch cluster, then compare both against an agreed ground truth. That ground truth can be exact brute-force nearest neighbors computed over the same embeddings, which isolates the engine and index settings from the embedding model. Keep the query set and ground truth frozen so that every test run compares the same things.

Test filtered queries separately, because filters are where approximate search most often drifts. Include the filter fields your application actually uses, such as tenant, language, category or access scope, and include edge cases: filters that match very few documents, filters that match none, empty query vectors, and vectors with the wrong dimension, which should fail in the same way on both sides. Check the k-NN engine and filter behavior that your chosen settings produce, and confirm those details against the OpenSearch k-NN documentation for your version rather than relying on memory of Elasticsearch behavior.

Record the acceptance threshold before the test runs. Agree the minimum recall, the query set and the pass criteria with the business owner of the search feature, and write them down before anyone sees results. The threshold is a product decision: it defines how many relevant results users can lose before the feature is worse, and it should be set against what users see, not against what is easy to reach. Ask the owner to sign off on the threshold, the sample size and the handling of failed queries, then rerun the same test after any change to engine, parameters or dimensions until it passes.

What goes wrong with vector migrations and how to prevent it

Vector search migrations usually fail in the parts around the index, not inside it. The risks below cover the assumptions, settings, application code and capacity decisions that tend to surface after cutover, each with a prevention step you can check before traffic moves.

Treating the mapping conversion as the whole job

Migration Assistant can convert dense_vector mappings to knn_vector during metadata migration, but that conversion only covers the index definition. Vectors, query code, filters and scoring still need separate work. Plan the mapping as one item in a list that also includes application queries, ingest paths and validation. Confirm the exact conversion behavior and any unsupported fields in the OpenSearch transform documentation before you rely on it.

Transform docs

Dimension and similarity mismatches

A vector dimension or distance metric that differs from the embedding model produces results that look valid but rank poorly. Compare the dimension count and similarity function in the old mapping with the values your embedding model produces and the values the converted knn_vector field expects. Test one known query against both clusters before cutover. Confirm the supported similarity settings and engine options in the OpenSearch k-NN documentation.

Query rewrites missed in one client

Elasticsearch script_score or knn query syntax does not carry over unchanged, so every service that searches vectors needs its own rewrite. A mobile backend, a batch job or an internal tool often sends a query the team forgot to inventory. Build a list of every client that issues vector queries by reviewing gateway logs and code search results. Then run each query type against the new cluster in staging. Confirm the target query syntax in the OpenSearch documentation.

Recall loss nobody measured

Approximate nearest neighbor search trades some accuracy for speed, so results can differ from the old cluster even when the index loads correctly. Without a baseline, the first sign of lost relevance is a user complaint. Build a fixed set of representative queries with known relevant results, run them against both clusters, and compare overlap at the top of the result list. Record the settings used so the test can be repeated after tuning. Set the acceptance threshold with the search owner before the test starts.

Memory sized from the old cluster

Vector index memory depends on the vector count, dimension, engine and index settings, not on how much disk the Elasticsearch cluster used. Copying the old node sizes can leave the new cluster short on memory or overbuilt for the workload. Estimate memory from the target engine and parameters, then load a representative share of production vectors into a test cluster and observe heap and native memory use. Confirm memory guidance for each engine in the OpenSearch documentation before you size production nodes.

Cutover without a rollback path

If the application switches to the new cluster and the index later proves wrong, the team needs a way back that does not lose recent writes. Keep the Elasticsearch cluster read-available until results are accepted, and decide in advance how writes made during the cutover window will be replayed or dual-written. Put the switch behind a configuration flag so the application can point back quickly. Rehearse the rollback once in staging so the steps are known before they are needed.

What buyers ask before moving vector search to OpenSearch

Is OpenSearch free to use for vector search?

Yes, the software itself is free to use. All software in the OpenSearch project is released under the Apache License, Version 2.0, and the OpenSearch FAQ does not describe any paid edition. Your costs are the infrastructure you run it on (compute, memory, storage and backups), the people who operate it, and any outside help you buy. Confirm the license terms for any add-on or distribution you plan to use with your legal team, since the license applies to the project software you deploy. Elasticsearch is a different case: its default distribution uses the Elastic License 2.0, so the license you already have on the source cluster is worth reviewing before you plan the move.

What drives the cost of migrating dense_vector fields?

The cost follows the inventory, not the field count alone. The main drivers are the number of indices that hold vectors, the vector dimensions and document counts that determine index size, how many query paths in your application call vector search, and how much recall testing you require before cutover. Cost is split between your own staff time, which is recurring during testing, and any external engineering you buy, which is usually one-time for the migration build. Ask any partner for a quote that lists each index, each application query path, the test datasets and the cutover approach as separate line items.

How long does a dense_vector to knn_vector migration take?

Duration depends on the inventory and how much of the application depends on the vector queries. Migration Assistant can convert dense_vector mappings to knn_vector mappings during metadata migration, so the mapping step itself is rarely the long pole. The longer work is backfilling the data, rewriting application queries, and running recall tests against real query traffic. Your timing will also depend on how many indices you have, how large they are, and whether you can freeze writes or need live traffic capture. Ask for a schedule built from your own index list rather than a generic estimate.

What must our internal team provide before the work starts?

Your team needs to provide the inventory and the access to test the result. Expect to supply:

  • A list of every index with a dense_vector field, its dimensions, its similarity setting and its document count
  • The application code paths that issue vector queries, including any script_score or filter logic
  • Sample queries and a labeled set of expected results that represent real user intent
  • Access to the source cluster snapshots, a target environment in your infrastructure, and named owners for security and cutover decisions

Missing any of these usually pushes the work into discovery, which extends the schedule.

Can our own team migrate vector search without outside help?

A team with Elasticsearch operations experience and application developers who own the vector queries can do it alone, provided they plan for the parts that are easy to underestimate. The migration path is documented, and Migration Assistant handles the metadata conversion, but the application query rewrites and recall testing still need someone who understands both the search model and the business expectations. The decision usually comes down to whether your team has the time, the test data and the on-call capacity during cutover. DeployOpen plans, implements and tests this work inside your infrastructure under a written scope if you prefer a partner for part or all of it.

Do we need to re-embed our documents after migrating?

Usually no, because the stored vectors move with the data and the conversion changes the mapping type, not the numbers. The migration keeps the vector values, so you do not need to call your embedding model again to move the existing corpus. You should still confirm that the similarity function, normalization and dimensions in the target mapping match what your application expects, because a mismatch changes ranking even when the data is intact. Re-embedding becomes necessary only if you change the embedding model, the dimensions or the preprocessing pipeline as part of the move.

How do we judge whether recall held up after the move?

Measure recall against a baseline built from the source cluster, not against intuition. Run a fixed set of representative queries against both clusters, record the top results from each, and compare the overlap at the cutoff your application uses. Use a labeled set where possible, since overlap alone does not show relevance. Test the engine and parameter choices on your own data, and repeat the comparison after any change to the k-NN settings. Keep the results as evidence for your change record, and set the acceptance threshold with the product owner before the test runs.

Which security controls should we review in the target cluster?

Review access and data handling before you load vectors, because embeddings can reveal the content they were built from. The OpenSearch Security plugin provides role-based access control, document-level and field-level security, audit logs and TLS for node and client traffic. Confirm that roles for vector indices match the access model of the source documents, and that the query paths in your application cannot read indices outside the caller's permissions. Ask for these checks to be written into the test plan so the security team can review the evidence.

How DeployOpen scopes, delivers and supports a vector migration

DeployOpen plans, builds, tests and hands over self-hosted OpenSearch inside your own infrastructure, so the dense_vector to knn_vector move runs under your controls. Engagements are fixed-scope, with the mapping conversion, engine choice, application query changes and recall testing agreed in writing before work starts.

How we scope

  • We inventory every index with dense_vector fields, their dimensions, similarity settings and the queries that read them.
  • The written scope names the conversion path, target OpenSearch version, engine choice and which application services change.
  • We agree recall thresholds and test query sets in writing so acceptance criteria are known before the build starts.
  • Scope also records who owns the source cluster, the target cluster and the application code changes.

How we build

  • We run Migration Assistant metadata conversion in a staging copy and review each generated knn_vector mapping by hand.
  • We rewrite the application's vector query calls against the target k-NN query syntax and test them in a non-production environment.
  • We run a recall comparison between the Elasticsearch results and the OpenSearch results on the agreed query set.
  • We configure access control, TLS and audit logging on the target cluster before any production data is loaded.

How we hand over

  • You receive the mapping differences, engine and dimension decisions, and the reasons behind each one in writing.
  • You receive the rewritten query code, test results, recall measurements and the cutover runbook with rollback steps.
  • Operating notes cover index settings, snapshot schedules, OpenSearch version maintenance and who patches what.
  • Documentation is written so your own engineers and compliance reviewers can trace each decision to its evidence.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover re-running recall tests when embedding models change, which changes vector dimensions and results.
  • Upgrades to newer OpenSearch minor versions are planned and tested before they reach production clusters.
  • Support scope is set in the written agreement, so response and maintenance expectations are confirmed before work begins.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.