When OpenSearch data streams fit log and metric workloads
Use an OpenSearch data stream when your team ingests logs or metrics that are written once and never changed, and you want retention and rotation handled without managing index names by hand. A data stream gives you one name for writes and searches while OpenSearch rolls the underlying indexes over for you. Every document must carry a timestamp field, and the stream is append-only, so this model fits event records rather than mutable business objects. According to the OpenSearch data streams documentation, the stream is one name backed by hidden indexes: writes go to the current write index and searches run across all backing indexes.
The stream is configured from a single index template, which must match the stream name and define the timestamp field and the mappings all backing indexes will share. Confirm the timestamp field name and type in your template before ingestion starts, because the stream depends on it and changing it later means a new stream. Teams that already run index templates for daily indexes should check how rollover and retention will replace their naming pattern, and which ingest pipelines and log shippers will target the stream name instead of dated indexes.
Do not use a data stream for documents that need frequent in-place updates or deletes of individual records, such as customer profiles, order status or reference data. Those workloads belong in regular indexes. OpenSearch Dashboards and the Security plugin apply to a data stream much as they do to other indexes, so you can build index patterns on it and set role-based and document-level permissions against it. Confirm the exact permission scope for backing indexes with your role design before you grant access, since access rules written for one index name may not cover hidden backing indexes as you expect.
Which configuration choice fits which data
Application logs are the most common append-only workload for data streams. Each event has a time of occurrence, teams search recent events most often, and older events are kept for a retention period set by security, operations or compliance owners. The template should reflect how the logs are shaped and how long they must stay searchable.
- Timestamp mapping: Map the timestamp field as a date type in the index template, and confirm that the shipper sends the event time from the application rather than the time of ingest, so every document carries the field the stream requires.
- Shard and replica counts: Set primary shards and replicas per backing index from expected daily volume and query load measured in a test cluster, and confirm the replica count against the number of node failures your availability target allows.
- Rollover approach: Roll over on size or age so each backing index stays within the range your nodes handle well, and choose the thresholds from observed ingest rates rather than from estimates made before go-live.
- Retention: Add a delete step to the lifecycle policy that matches the investigation and audit period agreed with your security and compliance owners.
Before fixing the template, check the clock accuracy and field consistency of each log source, because unreliable timestamps make time-based searches and retention decisions misleading.
Infrastructure metrics arrive as frequent numeric samples, each with a timestamp, a metric name and a set of labels such as host, service or region. The volume per document is small, but the number of distinct label combinations can grow quickly. The template decisions therefore center on field types and on how many series each backing index will hold.
- Timestamp mapping: Map the timestamp as a date field and keep sampling intervals consistent across collectors, so dashboards and alerts compare like with like.
- Field types for values and labels: Map numeric values as numeric fields and labels as keyword fields, and avoid dynamic mapping for label names that come from application code.
- Cardinality limits: Confirm which labels are high-cardinality, such as request identifiers or user identifiers, and keep them out of metric documents, since each new value adds to index size and query cost.
- Shard and replica counts: Size primary shards from measured sample rates in your environment, and set replicas so that dashboards and alerting keep working when a node is lost.
- Rollover approach: Roll over by age when metrics need predictable time windows for review, and add size limits so a burst of new series does not produce an oversized backing index.
Ask your metrics team for the number of active series per source and their expected growth, because that count shapes the template more than the raw sample rate.
Data streams are append-only, so records that teams edit or remove after creation do not belong in a stream without changes to the design. Examples include case records, asset entries and customer-facing content. Choosing the right structure for these records matters more than tuning the template, because a stream cannot be converted into a standard index without a migration.
- Separate the data types: Keep immutable events such as logs and metrics in data streams, and store mutable records in a standard index behind an alias, so each dataset gets the write behavior it needs.
- Timestamp handling for mutable records: Keep a timestamp field in the template for either structure, and decide whether it records creation time, last update time or both.
- Targeting updates and deletes: Updates and deletes on documents in a stream must address the backing index that holds the document, so confirm the exact request forms and the per-backing-index behavior in the documentation before building an application around them.
- Operational cost: Plan for the extra work of finding and removing documents across backing indexes and for the index load it creates, and test those operations at expected volume.
Request a written list of every record type that will be edited or deleted, and map each one to a stream or a standard index before the template is finalized. The OpenSearch data streams documentation sets out the supported operations for this check.
How to set up a data stream step by step
This sequence takes a team from a timestamped document shape to a working data stream whose backing indexes roll over on a schedule the team controls, with a check at each step so problems surface before production data arrives.
Confirm the timestamp field in every document
Before anything is created, agree on one timestamp field name and type that every log or metric document will carry, such as
@timestamp, and confirm that your shippers (Data Prepper, OpenTelemetry Collector, Logstash or Beats) populate it in the same format for every source. Mixed field names or unparsed time strings are the most common reason a stream rejects writes later. Run a sample of documents through your pipeline and check that each one contains the field. You know this step is done when a test batch from every source shows the same timestamp field, with no missing or differently named values.Create the index template with the data stream definition
Create an index template whose index patterns match the name you want for the stream, add a
data_streamblock to it, and define the mappings for the timestamp and the fields your queries depend on. Set the template's priority so no other template with an overlapping pattern can take precedence. Treat the mappings as the contract for the stream, because they apply to every backing index OpenSearch creates later. You know this step is done when the template is stored and aGET _index_templatecall returns it with the expected patterns, priority and mappings.Create the stream by writing to it
Create the stream explicitly with a
PUT _data_streamrequest using the same name, or let the first write create it, which works only when a matching template with adata_streamdefinition already exists. Send a small test document with the timestamp field to the stream name. Writes are append-only, so use a throwaway name for testing if you do not want the test document to remain in the stream. You know this step is done when the request returns an acknowledgement and the stream name appears in the list of data streams.Verify the backing index and the write index
List the stream with
GET _data_stream/<name>and then list its backing indexes. Each backing index has a generated name that includes the stream name and a generation number, and the stream's current write index is the newest one. Confirm that the test document was indexed into that write index and that the backing indexes are hidden from ordinary index listings, which is how the stream presents one name to users. You know this step is done when the stream reports exactly one backing index, it is marked as the write index, and the test document's count matches what you sent.Configure rollover and the lifecycle policy
Decide how often the write index should roll over, by size, age or document count, and set those conditions in the stream's lifecycle settings or in an Index State Management policy attached to the template. Rollover is what creates new backing indexes over time, so a policy that never triggers will leave a single very large index. Set retention in the same policy so old backing indexes are deleted on a schedule you can audit. Confirm the exact rollover and deletion options for your OpenSearch version in the Index State Management documentation before you commit to them. You know this step is done when the policy is attached to the stream and a dry run or forced rollover produces a new generation.
Test ingestion and search across backing indexes
Force a rollover in a non-production copy of the stream, then send a batch of documents spanning the rollover point. Search the stream by its single name and confirm that results come back from every backing index, while a write request still lands only in the current write index. Check that your dashboards and saved queries work against the stream name and that the timestamp field supports the range filters they use. You know this step is done when a search returns documents from both the old and new backing indexes and the document counts reconcile with what was sent.
Document updates, deletes and access before go-live
Record how your team will handle the limits of an append-only stream: updates and deletes target a specific backing index and document ID rather than the stream name, so corrections need a defined procedure. Agree on who may write, search and manage the stream by setting roles on the stream name, and confirm that retention and audit settings match your requirements. Ask your platform owner or partner to confirm these settings against your OpenSearch version and security configuration. You know this step is done when the runbook lists the correction procedure, the roles are tested with a non-admin user, and the retention policy is documented.
How writes and searches flow through a data stream
The diagram starts with a shipper sending append-only documents to the data stream name. OpenSearch routes each write to the current write index, which is one of the hidden backing indexes. When rollover creates a new backing index, new writes move to it while older backing indexes stay in place. A search on the data stream name fans out to all backing indexes. Check that every document carries the required timestamp field, since the stream rejects documents without one.
Writes land on the current write index, and searches read every backing index.
How updates and deletes work on a data stream
A data stream is append-only, so the update and delete model differs from a regular index. You should not plan on changing a document in place the way you would in a standard index. Each document lives in one of the hidden backing indexes, and any update or delete has to address that backing index, not the stream name alone. Before you commit a logging design, confirm in the OpenSearch data streams documentation for your exact version how document-level updates and deletes are accepted, which operations are routed to backing indexes, and whether bulk update requests behave the same way. Test those calls against a non-production stream with the same index template you plan to use.
The practical consequence for log retention is that deleting old data usually means removing whole backing indexes, not individual documents. Rolled-over backing indexes are the unit of retention, so your retention period effectively sets how many backing indexes survive, and the rollover conditions you choose determine how much data each one holds. Lifecycle management can delete backing indexes once they age past your policy, which is the cleanest path for logs. Ask your team whether any compliance requirement calls for removing a single record, since that case needs a different design, such as reindexing the affected data into a new stream or keeping that data outside the stream altogether.
Plan for corrections and deletions before the first production write. Decide who may run update or delete requests against a stream, how those requests are audited, and whether a reindex job is acceptable for the rare case of a required record removal. Reindexing copies data into a new target, so it adds storage and compute cost and needs its own verification step. Confirm the update and delete behavior, the reindex options and any lifecycle deletion settings in the docs for the OpenSearch version you will run, and record the results in your runbook.
Access control and operational risks for data streams
A data stream concentrates writes, reads and retention behind one name, so a mistake in access, mappings, templates or lifecycle settings affects every backing index at once. The cards below cover the controls to plan before the first production write and the checks to repeat after each change.
Role-based access to the stream
Grant roles on the data stream name and on its backing indexes through the Security plugin, and decide which principals may write, read or manage the stream. Write access to the stream is not the same as read access to every backing index, so test each role with a real user before go-live. Check that shipper accounts can index but cannot delete or alter templates, and that analysts can search without changing lifecycle settings.
Security plugin docsTimestamp and mapping rejections
Every document needs a timestamp field, and a write that lacks one or carries an incompatible mapping is rejected. Shippers that change field types, such as a numeric status code that later arrives as text, can start failing silently at the agent. Validate sample events against the template in a test stream, and monitor rejected write counts after each agent or parser release.
Index template drift across clusters
Each data stream takes its mappings and settings from a single index template, so the template is the contract for every backing index. When development, staging and production clusters hold different template versions, the same log source produces different mappings and queries behave differently by environment. Store templates as code, deploy them through the same pipeline everywhere, and compare the live template on each cluster after changes.
Rollover and retention deleting early
Data streams roll over to new backing indexes on conditions you set, and retention policies remove old backing indexes. A rollover threshold set too low multiplies small indexes, while a retention period set too short deletes investigation data sooner than your policy requires. Confirm the retention period with the team that owns the policy, and test the lifecycle on a copy before applying it to production streams.
Audit logging of writes and deletes
Writes and deletes against a data stream should be recorded by the Security plugin's audit logs, so you can show who changed or removed log data. Decide which audit categories to enable, where the records are stored, and who can read them. Keep audit records outside the cluster they describe, because an administrator who can delete data should not also control the only record of that deletion.
TLS for shipper traffic
Log shippers send events over the network to the cluster, so transport and client traffic should use TLS, which the Security plugin supports for both node and client connections. Confirm that every shipper validates the cluster certificate, that certificate rotation is scheduled, and that no shipper falls back to plaintext when a certificate expires. Test the connection path from each collection host, not only from one test machine.
Questions teams ask before setting up data streams
What does setting up data streams cost, and who pays for what?
Cost splits into two parts: internal engineering time and any fixed-scope partner work. Internal time covers the cluster owners who decide retention, the application teams who define the timestamp field and log format, and the security or compliance reviewers who sign off on retention and access. Partner work, when you buy it, is usually priced from a written scope that lists the sources to onboard, the mapping and index template work, the rollover and retention rules, and the verification steps. The main cost drivers are the number of log sources, how complex the field mappings are, and how many retention rules you must enforce. Ask any quote to separate one-time work (templates, policies, onboarding) from recurring work (upgrades, template changes, retention reviews) and to state what is excluded. DeployOpen does not publish a price list, so a quote follows from the written scope.
How long does a data stream setup take?
Duration depends on scope rather than on the feature itself. A single application writing one well-formed event stream with an agreed timestamp field is a small piece of work. A multi-source rollout with inconsistent timestamps, several index templates, custom rollover rules and access controls takes longer, mostly because the mapping and retention decisions need input from data owners. No duration is set by a researched fact, so ask for a timeline in the written scope that ties each phase to a deliverable: source inventory, template design, a test stream, rollover and retention verification, and handover. Your own change windows and approval steps will also set the pace.
What must our team provide before the work starts?
Plan to provide four things before setup begins:
- Access to the target OpenSearch cluster, including an administrative role that can create index templates, index state policies and roles in a test environment first.
- Sample logs or events from each source, with the fields and the timestamp format in use, including any time zone quirks.
- Written retention requirements per stream, such as how long hot data stays searchable and when old data must be deleted.
- A named owner for each source who can confirm field meanings and approve changes to the schema.
If retention comes from a policy or regulation, bring the clause and the team that interprets it so the rules are not guessed.
Can our own team set up data streams without a partner?
Yes, a team that already runs OpenSearch can set up data streams in-house. The core work is defining one index template with a timestamp field, creating the data stream, and confirming that writes reach the current write index and that rollover behaves as expected. The harder parts are judgment calls: choosing the timestamp field, deciding which fields to map explicitly, and writing retention rules that match your policy. Teams without OpenSearch operations experience usually benefit from a partner review of those decisions. Confirm the exact API behavior, versions and rollover settings against the OpenSearch data streams documentation for your release before you rely on them.
Can we move existing Elasticsearch indices into data streams?
Existing indices do not convert into a data stream in place. You create a new data stream and move the data through a migration path. OpenSearch is wire-compatible with Elasticsearch 7.10 and can use indices from Elasticsearch 6.0 through 7.10, so an Elasticsearch cluster in that range has a documented route. OpenSearch documents four upgrade and migration methods: rolling upgrades, snapshot and restore, remote reindexing and Migration Assistant. Which one fits depends on your source version, downtime tolerance and whether you need to keep old index names. Confirm the source version and the method in the migration documentation before you plan the cutover, and treat old indices as read-only history until the new streams are verified.
Do data streams support updates and deletes?
Not in the way a normal index does. A data stream is append-only: documents are added to the current write index and are not edited there in place. Plan corrections and removals as separate operations, and check the current behavior for your OpenSearch version in the data streams documentation before building a process on it. Retention is usually handled by rollover and deletion of old backing indices rather than by deleting individual documents, which matters for any privacy or legal-hold request that targets a specific record. Ask your team to define that process before go-live.
What breaks most often when teams set up data streams?
The most common failures are predictable. Events arrive without the required timestamp field, or the timestamp uses a format the template does not expect, so writes are rejected. Teams apply one template to sources with different field types, which creates mapping conflicts. Rollover settings are left at defaults that do not match the write volume, so backing indices grow too large or too many small ones accumulate. Access roles are written for the data stream name but not for the hidden backing indices, which surprises users. Finally, retention is set without confirming who owns the deletion decision. Test each source with representative sample data in a non-production cluster before you point production shippers at the stream.
How should we check that a data stream works after setup?
Check it in four steps. First, send a set of sample events, including malformed ones, and confirm which are accepted and which are rejected. Second, confirm writes land in the current write index and that searches across the stream return results from every backing index. Third, force or wait for a rollover and confirm the new backing index uses the template settings. Fourth, run the retention rule in a test environment and confirm it removes only the indices it should. Keep the results as evidence for your operations and compliance teams. Your own runbook should name the owner of each check and the cluster role that runs it.
Version and maintenance questions to settle first
Before you write any index template, confirm which OpenSearch minor version your cluster runs and how long that version stays supported. OpenSearch releases receive bug fixes and security patches during maintenance but no new features, and the project targets a new minor version about every eight weeks. That means a version you pick today can fall behind the data stream behavior described in newer docs within a few release cycles, so the template you write must match the docs for the version you actually run, not the latest page you read.
Check three things in writing. First, read the data streams documentation for your exact version, since the rules for timestamp fields, rollover and how backing indexes are named are the parts most likely to change between releases. Second, confirm the support window for your version on the OpenSearch releases page, because a version in maintenance only gets fixes until the next major version or one year has passed, whichever is longer. Third, write down your upgrade path to the next minor and major release, including whether you will use a rolling upgrade or snapshot and restore, before you build templates around the current behavior.
Ask your DeployOpen team, or your own platform engineers, to record these answers in the design document with the cluster version, the docs link used, and the planned upgrade window. Templates, rollover settings and client mappings should then be tested on a non-production cluster at the same version before each upgrade. If a template relies on behavior that changed in a later release, the upgrade test is where you find it, not your production log pipeline.
How DeployOpen scopes and delivers data stream setups
DeployOpen plans, builds, tests and documents OpenSearch data streams for logs and metrics inside infrastructure you control. The work starts with agreed data sources, retention and access rules, then moves through a written scope, a tested build and a handover your team can run.
How we scope
- Inventory the log and metric sources, their timestamp fields and expected write volumes before any template is drafted.
- Agree retention, rollover conditions and who may write, search or delete in a written scope.
- Confirm the OpenSearch version and deployment method your environment supports before the build begins.
How we build
- Create the index template with the required timestamp mapping, field types and shard settings for each stream.
- Configure rollover and index state rules, then test ingestion with representative sample data.
- Document how updates and deletes are handled, since data streams are append-only, and build the workarounds your sources need.
How we hand over
- Deliver the templates, policies and configuration as version-controlled files with a written runbook.
- Walk your operators through checking backing indexes, rollover behavior and retention in a live cluster.
- Record the access roles, test results and open decisions so your compliance and security teams can review them.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial handover.
- Review template and rollover changes when new log sources or OpenSearch releases arrive.
- Confirm support terms and response expectations in the written scope before work starts.

