Why teams host embedding models inside their OpenSearch cluster
If your team wants semantic search over data it cannot send to an outside embedding API, OpenSearch can run the embedding model inside your own cluster. Since OpenSearch 2.9, pretrained sentence transformer models from Hugging Face and sparse encoding models trained by OpenSearch can run locally, so documents and queries are converted to vectors without leaving your infrastructure. The ML Commons plugin handles this. It loads the model files, runs inference on the cluster's ML nodes, and exposes the model through ingest and search pipeline processors so that indexing and querying call the model automatically.
This approach fits when the text is sensitive, when data residency or contractual terms rule out a third-party model endpoint, or when you need predictable cost and latency without per-call charges. It also keeps model access under the same Security plugin controls, TLS settings and audit logging you already use for the rest of the cluster. It fits less well when you need a large generative or frontier model that is far beyond what a single cluster should host, or when your team has no capacity to test, patch and version models. In those cases, an external or separately hosted model service may be the better fit, and the work shifts to a connector and a data-handling review.
Before committing, confirm three things with your own environment and the current OpenSearch documentation. First, check which models your target version supports, their licenses and the vector dimensions they produce, since these determine index mappings. Second, measure whether your existing data nodes have enough memory and CPU for inference, or whether dedicated ML nodes are needed. Third, decide who owns model updates, because changing a model usually means re-embedding the corpus. The OpenSearch pretrained models documentation is the natural next read for the supported model list and their current requirements.
How documents flow through ML nodes at index and query time
The flow starts with a client or ingest pipeline sending text to the model on an ML-role node, which returns embeddings. Those vectors are written to a k-NN index on data nodes, while search queries pass through the same model before the lookup. Check that the model files were loaded from a source you approved, that ML nodes sit inside the cluster trust boundary, and that query and document text use the same model version.
Documents and queries are embedded by the same in-cluster model before reaching the k-NN index.
Which model source and node layout fits your workload
This table compares the three model sources and the two node layouts, with CPU and GPU acceleration noted for each. Read each row against your document volume, latency needs and hardware, then use the takeaway to shortlist an approach before sizing.
| Option | When it fits | Trade-off to plan for |
|---|---|---|
| OpenSearch pretrained sentence transformer models | You want dense embeddings from a Hugging Face sentence transformer that runs locally in the cluster, without writing a custom model package | Input beyond 512 tokens is typically truncated for BERT-based models, so long documents need chunking first |
| OpenSearch-trained sparse encoding models | You want semantic retrieval using sparse vectors that OpenSearch trained, and you prefer that approach to dense vectors | Confirm the model version and token behavior for your OpenSearch release before committing to a retrieval design |
| Custom models you upload | Your organization has a model it has already validated or is required to use | You own packaging, versioning, token limits and the review evidence for that model, which increases effort |
| Dedicated ML nodes | You need predictable inference load isolated from indexing and query traffic on data nodes | Extra nodes add infrastructure cost and must be patched, backed up and monitored like other cluster members |
| Shared data nodes | Inference volume is light, such as small indexes or occasional re-embedding | Model inference competes with search and indexing for memory and CPU, so latency can rise under load |
| CPU acceleration | Workloads are modest, latency targets are relaxed and you want the simplest hardware profile | Throughput is lower for large batches, so confirm capacity with a load test on your own data |
| GPU acceleration | You need high throughput on large embedding or ingest jobs and have NVIDIA or AWS Inferentia capacity | Requires NVIDIA instances with CUDA 11.6 or AWS Inferentia and PyTorch 1.12.1, so driver and version alignment must be planned |
How token limits and chunking shape document design
BERT-based embedding models typically truncate input beyond 512 tokens, and the OpenSearch pretrained models documentation advises splitting long documents into chunks before embedding them. Truncation is silent in many pipelines: the model embeds only the first part of a document, and the rest of the text never influences retrieval. The limit applies to tokens, not words or characters, so the same paragraph can fit or overflow depending on the tokenizer and the language. Confirm the maximum input length for the exact model you deploy, because models differ and the default is not a guarantee for every model in the catalog.
- Token count, not word count: Measure chunks with the model's own tokenizer so a chunk that looks short in English does not overflow.
- Silent truncation: Check whether the ML inference path reports or cuts oversized input, and test with a document longer than the limit.
- Model-specific limits: Record the maximum input length from the model's documentation or configuration for each model you host.
- Query length: Apply the same limit to search queries, which are usually short but can be long for question-style input.
- Multilingual text: Token density varies by language, so set chunk sizes from measured token counts in each language you index.
Before you fix a chunk size, confirm the input limit of your model and count tokens on a sample of real documents.
Chunk size sets how much meaning each vector represents. Small chunks produce precise vectors that match narrow questions, but they can lose the context needed to answer a question that spans a paragraph. Large chunks keep context but blend several topics into one vector, which weakens matches for specific facts. Overlap repeats a portion of text at the boundary between neighboring chunks, so a sentence split across two chunks still appears whole in at least one of them. Overlap increases the number of vectors to store, index and query, so it adds memory and storage cost in proportion to the amount of repetition.
- Size against the question type: Short factual questions usually favor smaller chunks, while summaries and multi-step procedures usually need larger ones.
- Boundary placement: Split on headings, paragraphs or sentences where possible instead of at fixed character counts.
- Overlap cost: Estimate how many extra vectors a given overlap creates across your corpus before you choose it.
- Storage effect: Vector memory and disk use grow with the number of chunks, so chunk strategy feeds directly into node sizing.
- Retrieval evaluation: Compare recall and answer quality across two or three settings instead of choosing a default.
Run a small evaluation set of realistic questions against each candidate chunk size and overlap before sizing the cluster.
A chunk without its surroundings is hard to interpret. The title, section heading, document identifier, date, access group and source location tell the retrieval layer and the reader what a chunk belongs to. Store these fields alongside each chunk so they can be returned with results, used for filtering and checked by access controls. Metadata also supports incremental re-indexing, because you can find and replace all chunks from one source document when it changes. Plan the fields before ingestion starts, since changing the document model later often means re-chunking and re-embedding the whole corpus.
- Parent document link: Keep an identifier that ties each chunk to its source document and its position in that document.
- Section context: Store the heading path so a chunk can be understood when it appears alone in results.
- Access attributes: Carry the permission or tenant field on every chunk so security filters apply to vector queries as well as keyword queries.
- Versioning: Record a document version or timestamp so stale chunks can be removed when a source changes.
- Optional context text: Decide whether heading text is embedded with the chunk or only stored, since that changes what the vector represents.
Review the metadata schema with the security and data owners before ingestion, because access attributes are hard to add safely after the fact.
A chunking strategy is a hypothesis until it is measured against your own documents. Public benchmarks use different text, lengths and question styles, so results on them do not predict how your manuals, tickets or policies will behave. A useful test uses a representative sample of documents, a set of questions with known source passages, and a comparison of retrieval results across chunk sizes and overlap values. Measure whether the correct passage appears in the top results and whether the text returned to users is coherent. Repeat the test whenever the model, the corpus or the query patterns change.
- Representative sample: Include long documents, short notes, tables and any multilingual content, not only clean examples.
- Labeled questions: Write questions with known answer passages so retrieval can be scored, not judged by impression.
- Parameter grid: Test a small number of chunk sizes and overlaps, and record the vector count each produces.
- Failure review: Inspect the misses to find whether the problem is boundary placement, missing context or truncation.
- Model check: Confirm the maximum input length with the model configuration and rerun the test after any model change.
If your team lacks a labeled question set, ask your search or application owners to build one before the cluster is sized, and ask any implementation partner to deliver the test results as part of the scope.
The chunking choices become part of the operating model, so they should be documented in the same place as the cluster design. The record should name the model and its input limit, the tokenizer used for counting, the chunk size and overlap, the boundary rules and the metadata schema. It should also state how the team will detect and handle truncation, re-chunk documents and remove stale chunks. Writing these decisions down lets security reviewers, compliance staff and future engineers understand what the search results depend on. It also makes the cost of a change visible, because a new model or a new chunk size usually means re-embedding the corpus.
- Model and limit: Record the model name, version, maximum input length and where that value was confirmed.
- Chunk parameters: Record size, overlap and the unit used to measure them.
- Re-indexing plan: Describe how a changed document or a changed model triggers re-chunking and re-embedding.
- Data retention: Define how long chunks are kept after their source document is deleted.
- Review trigger: Set the events that require the chunking design to be tested again.
Ask for this record as a deliverable in any quote, so chunking decisions are reviewable rather than buried in ingestion code.
How to set up pretrained models on ML nodes
This sequence takes a self-hosted OpenSearch cluster from a version check to a working embedding model that returns vectors from a test query. Each step ends with a check so the team can confirm the model runs inside its own infrastructure before indexing production data.
Confirm the OpenSearch version supports local models
Confirm the cluster runs OpenSearch 2.9 or later, because pretrained sentence transformer models and sparse encoding models trained by OpenSearch can run locally in the cluster only from that version onward. The cluster administrator checks the version on the cluster root endpoint and records it in the change ticket. Done means the version is 2.9 or later and the team has agreed to keep it there through upgrades, since a version below 2.9 cannot run these models. Confirm the exact version against the official pretrained models docs before you proceed.
Plan dedicated ML node roles and capacity
Decide which nodes will carry the machine learning role and whether they will be dedicated, so model inference does not compete with search and indexing on data nodes. The platform team sizes memory and CPU for the chosen model and any GPU hardware, and confirms with the OpenSearch documentation how ML node roles are assigned in your deployment method. Done means a written node layout exists, lists which hosts hold the ML role, and shows the hardware each host provides. Ask your vendor or internal platform owner to confirm capacity before you assign roles.
Enable ML Commons settings on the cluster
Apply the ML Commons cluster settings that allow model registration and deployment, and restrict which nodes may run models. The administrator with cluster-level permissions makes the change through the cluster settings API, using the exact keys listed in the official pretrained models docs for your version. Done means a read of the cluster settings shows the ML Commons values as applied and the change is recorded in version control or the change log.
Register and deploy a pretrained embedding model
Register a sentence transformer model from the pretrained catalog, or a sparse encoding model trained by OpenSearch, then deploy it to the ML nodes. Record the model ID returned by registration and the deployment state. The engineer checks the model task type and its maximum input length, because BERT-based embedding models typically truncate input beyond 512 tokens. Done means the deployment reports a ready state on the intended nodes and the model ID is stored for later steps.
Create an ingest pipeline or inference processor
Create an ingest pipeline with a text embedding processor, or an inference processor that calls the deployed model, and point the field mapping at the source text field and the target vector field. The search engineer defines the target field as a k-NN vector field with a dimension that matches the model output. Done means the pipeline is saved and a simulate call on one sample document returns an embedding field of the expected length.
Chunk long documents before embedding
Because input beyond the model token limit is truncated, add a chunking step to the pipeline or to the application that prepares documents, and store each chunk as its own indexed item with a reference back to the parent document. The engineer tests long sample documents and confirms that no chunk exceeds the token limit. Done means a long test document produces several chunk records, each with its own embedding, and the parent reference resolves correctly.
Verify embeddings with a test query
Index a small set of known test documents through the pipeline, then run a neural or k-NN query using the same model to confirm that semantically related text ranks above unrelated text. The search engineer reviews the top results and the returned embeddings, and checks the node that served the inference call in the deployment status. Done means the test query returns the expected ranking and the team has saved the query and results as a baseline for future upgrades.
What GPU acceleration requires and when to skip it
GPU-accelerated ML nodes are an optional capacity choice, not a default for running embedding models in OpenSearch. The cards below cover the supported hardware and software stack, the compatibility checks to run before purchase, and the cases where CPU-based ML nodes are the simpler path.
Supported NVIDIA configurations
The documented GPU path uses NVIDIA instances with CUDA 11.6. Confirm that your chosen instance type, GPU driver, and container runtime all support that CUDA version before you size anything. Mismatches between the driver, the CUDA runtime inside the container, and the host operating system are the most common reason a GPU node fails to load a model. Ask your hardware vendor or cloud provider to confirm the full stack in writing for your image.
GPU acceleration docsAWS Inferentia instances
Inferentia is the other documented accelerator option for OpenSearch ML nodes. It suits teams already running on AWS who want inference hardware separate from general GPU capacity. Check that the model you plan to host is available in a form the accelerator path supports, and confirm which OpenSearch version and ML Commons build include that path. Do not assume a model that runs on NVIDIA will run unchanged on Inferentia.
PyTorch version pinning
The documented GPU acceleration path requires PyTorch 1.12.1. Pin this version in every environment that builds or serves the model, including air-gapped mirrors. Upgrading PyTorch independently of OpenSearch can break model loading, so treat the version as part of the cluster's change record. Plan for model artifacts that were built against this version to remain available when you upgrade OpenSearch.
Capacity and cost trade-offs
GPU nodes add a recurring hardware or cloud cost, plus the staff time to patch drivers and rebuild images. Compare that against the throughput you need from indexing and query-time embedding. If ingestion is batch-based and latency is not tight, CPU-based ML nodes often meet the requirement at lower operating cost. Ask any provider for the per-node cost, the reserved or committed term options, and what their quote covers.
When to skip the GPU
Skip GPU acceleration when the embedding volume is modest, when the model is small enough for CPU inference within your latency budget, or when your infrastructure cannot support the required driver and runtime stack. Skipping it also keeps the cluster on a simpler, more widely tested configuration. Revisit the decision after you measure indexing and query throughput with real data, not before.
Compatibility checks before purchase
Before buying hardware, run a proof of concept on the exact instance type, operating system image, container runtime and driver version you intend to use in production. Load the model you plan to host, confirm it completes inference, and record the versions in your build documentation. Ask the OpenSearch documentation and your vendor which configurations are verified, and confirm anything not stated there in your own environment.
How model placement affects cluster stability
Running an embedding model on the same nodes that hold data and serve queries lets inference compete with search and indexing for heap, CPU and memory, and that competition shows up as slow queries, rejected bulk requests or nodes leaving the cluster. Model inference is a bursty, compute-heavy workload that does not respect the shard boundaries OpenSearch uses for everything else. Before you load a model, decide which nodes will host it, and treat that decision as a capacity question rather than a configuration detail. Confirm the memory each model needs on your chosen version with the ML Commons documentation for that release, then size the ML nodes around that figure.
OpenSearch separates work across node roles. Cluster manager nodes hold cluster state and should be dedicated, so that a busy inference process cannot delay elections or state updates. Data nodes handle shard storage and most search and indexing load, and ingest nodes run pipeline processors. Dedicated ML nodes isolate inference from these roles, which keeps a model's memory pressure from triggering circuit breakers or garbage collection on the nodes that serve search. The trade-off is operational: each additional node role is another set of hosts to patch, monitor and capacity plan. A practical check is to confirm that cluster manager nodes carry no ML or search load in your test cluster before you expand to production.
Shard allocation awareness matters here for the same reason it matters for data. Replicas should sit on separate nodes, and where you run zones or racks, allocation awareness should spread copies across failure domains. Apply the same thinking to ML nodes: if every model-serving node sits in one zone, a single zone outage removes inference capacity for every pipeline that depends on it, even when the data tier survives. Ask your platform team which zones will host ML nodes, how many ML nodes you need to survive the loss of one, and how your ingest pipelines behave when inference is temporarily unavailable, since that answer decides whether indexing stalls or queues.
Security and access controls for in-cluster models
Models running inside the cluster inherit the cluster's security model, but they add their own permissions, files and data flows. The cards below cover who can act on models, how traffic and logs are protected, what the inputs contain, and how model files enter your environment.
Who can register and deploy models
Registering, deploying, undeploying and deleting a model are separate actions, and each should map to a named role. Model management is typically limited to a small platform group, while application teams receive only the permission to call a deployed model. Confirm in your own cluster which cluster permissions cover ML Commons model APIs, and test each role with a non-admin account before go-live.
OpenSearch security docsRole-based access for model calls
Search and ingest roles that call an embedding model during indexing or querying need only the model-level permission for that model, not general administrative rights. Scope these roles to specific indexes and pipelines so that a compromised application account cannot read unrelated data. Review role mappings whenever a new model is added to the cluster.
Audit logs for model activity
Enable audit logging so that model registration, deployment and inference requests leave a trace tied to a user or service identity. Send these logs to the same retention and review pipeline used for other cluster audit events. Confirm which audit categories your OpenSearch version records for ML Commons calls before relying on them in an investigation.
TLS for node and client traffic
Encrypt traffic between nodes and between clients and the cluster, including requests from ingest pipelines to ML nodes. A dedicated ML node is still a cluster node, so it needs the same certificate chain and rotation process as the rest of the cluster. Check that any external model endpoint used through a connector is also reached over TLS with verified certificates.
Sensitivity of model inputs
Embedding models receive raw document text, so every chunk that passes through a model is a copy of protected content. Classify the indexes that feed a model with the same labels used for their source data, and confirm that model outputs, which are vectors, inherit the same restrictions. Decide whether logs or traces capture input text, since that can spread sensitive content beyond the index.
Provenance and change control for model files
Pretrained sentence transformer models from Hugging Face and sparse encoding models trained by OpenSearch come from different sources and need different review. Record where each model file came from, which version was loaded, and who approved it, then route each new model or version through your change control process. Confirm the model artifact's hash and license before it reaches a production cluster.
- First OpenSearch version
- 2.9
Questions buyers ask about running embedding models in OpenSearch
What does it cost to run embedding models inside OpenSearch?
The cost is mostly hardware and people, not a license, because OpenSearch and its ML Commons plugin are released under the Apache License, Version 2.0 and the OpenSearch FAQ does not describe a paid edition. The recurring cost components are the ML node instances (CPU or GPU), the extra node count needed to keep model inference off your data nodes, storage for the model files, and staff time for patching and monitoring. The one-time cost is the design and build work: sizing, configuration, testing and documentation. Ask any partner for a quote that lists each component separately, states who pays for which hardware, and says which items recur monthly or annually.
How long does it take to get the first working embeddings?
The duration depends on whether the team already runs an OpenSearch cluster, which model is chosen, and whether the ML nodes must be added to an existing cluster or built alongside a new one. The main time sinks are capacity planning for the ML nodes, approvals for hosting model files inside your network, and testing the chunking and retrieval results against real documents. Confirm the expected timeline in the written scope rather than relying on a general estimate, and ask what the first milestone proves (for example, a model registered and deployed, and a sample index returning vectors).
What does our team need to provide for this work?
Your team needs to provide access to the target cluster or a test cluster, the cloud or data center accounts where ML nodes will run, and a decision on which models are approved for use. Security and compliance owners should confirm how model files are obtained and stored, and who may register or update models. Someone who owns the documents to be embedded must explain their content, sensitivity and update frequency, because that decides chunk size and reindexing rules. Plan for these contributions in the scope so that work does not stall waiting for access.
Can our own engineers build this without an outside partner?
Yes, if your team already operates OpenSearch and has Linux, container and network skills, because the documentation covers the ML Commons settings, model registration and deployment steps. The points where teams usually need help are dedicated ML node sizing, GPU driver and framework compatibility, token limits and chunking strategy, and evidence for security reviews. Compare the cost of your staff time against a fixed-scope engagement, and ask a partner to show which parts of the build they would hand over for your team to run.
Do we need GPUs to run embedding models in OpenSearch?
No, GPUs are optional. Pretrained sentence transformer models and sparse encoding models can run on CPU ML nodes, and the choice depends on throughput, latency and the volume of documents you embed. If you do want GPU acceleration, the documentation lists NVIDIA instances with CUDA 11.6 and AWS Inferentia, and it requires PyTorch 1.12.1 for GPU-accelerated ML nodes. Confirm these versions against the release you plan to run, because they change with the OpenSearch version and the hardware generation.
What happens to registered models when we upgrade OpenSearch?
Registered models and their deployments are tied to the ML Commons plugin and the cluster version, so an upgrade needs a compatibility check before you start. Test the upgrade on a non-production cluster, confirm that the model versions and the PyTorch runtime still match what the new release supports, and redeploy models if the documentation requires it. OpenSearch versions receive security patches during maintenance, so plan upgrades on a schedule that keeps you inside the maintenance window. Ask your partner how they will verify that search results and vector dimensions are unchanged after the upgrade.
What security questions should we answer before putting embedding models on ML nodes?
Start with where the model files come from, who can register or deploy them, and whether the ML nodes can reach external networks. Text sent for embedding is often sensitive, so confirm that it stays inside the cluster, that TLS protects node and client traffic, and that role-based access controls limit who can call the model API. Audit logs should show model registration and deployment changes. Ask for these controls in writing, and check the OpenSearch security documentation for the features your version supports.
Operating and upgrading models after go-live
The first operational task after go-live is confirming that every model deployment is in the state you expect, because a model can be registered, deployed to some nodes and still fail to serve inference. Check model state and deployment status through the ML Commons APIs on each ML node group, and alert on any deployment that is partially deployed or has failed. Track which model version each index was embedded with, usually by recording the model ID and version in an index-level field or in your own metadata store. That record is what makes a later model change safe to plan. Confirm the exact monitoring endpoints and fields for your release in the OpenSearch ML Commons documentation, since they change between versions.
Changing an embedding model means every vector in the affected index must be regenerated, because vectors from two different models are not comparable and mixing them silently degrades retrieval. Plan a full re-embedding job into a new index, run it on dedicated ML nodes or during a low-traffic window, then switch the alias and keep the old index until results are verified. Budget for the compute time of re-embedding the whole corpus, not only the new documents, and confirm with your team how long a full pass takes on your GPU or CPU capacity before setting a cutover date. The same approach applies to sparse encoding models and their rank features.
OpenSearch ships a new minor version about every eight weeks, and the current examples are 3.8.0, released on August 4, 2026, and 3.9.0, released on September 29, 2026. Under the maintenance policy, a version receives bug fixes and security patches but no new features, so a cluster can stay on a supported version for a time while you schedule the move. Before any minor upgrade, test the ML Commons plugin, the model versions, the connector settings and the GPU driver and PyTorch combination in a staging cluster built from the same configuration as production. Treat a model version change as a separate change from a server version change, so a failure can be traced to one of them. Confirm the support window for your target version on the OpenSearch releases page before you approve the upgrade.
How DeployOpen scopes and delivers embedding model hosting
DeployOpen plans, builds, tests and documents self-hosted OpenSearch inside infrastructure you control, including the ML nodes that run embedding models. Engagements are fixed-scope, with the scope, deliverables and timeline agreed in writing before work starts, so your team knows what it will receive and how it will run.
How we scope
- Confirm which OpenSearch version and pretrained model families your use case needs before design starts
- Map document types, average and maximum lengths, and the chunking approach that fits your content
- Size dedicated ML nodes and decide whether GPU acceleration is needed, with the hardware named in writing
- Agree the written scope, deliverables and timeline before any work begins
How we build
- Deploy the cluster with dedicated ML nodes, separate from data nodes, using your chosen install method
- Register and deploy the chosen embedding or sparse encoding model, then confirm it runs locally
- Configure ingest pipelines and chunking so long documents stay within model token limits
- Apply TLS, role-based access and audit logging to model, index and inference APIs
How we hand over
- Test indexing and query paths with your own sample documents and record the results
- Document model versions, pipeline definitions, node roles and GPU driver and framework requirements
- Write runbooks for model redeployment, version upgrades and recovery after a node failure
- Provide evidence your compliance and security teams can review, without issuing any audit opinion
How we support
- Plan upgrade paths for OpenSearch minor and major versions, with model compatibility checked at each step
- Retest embedding pipelines after each version change or model swap
- Offer ongoing support, upgrades and continuous testing as a retainer after handover
- Confirm current maintenance status and support windows for your version with the OpenSearch releases page

