RousselTMLEARNING

Article · Elasticsearch: from discovery to expertise

Data streams and templates

1. Principle #

One name, several indices.

Architecture #

Data stream and templates
  • A data stream is a logical name (logs-nginx-prod) for append-only timestamped data; it requires a @timestamp field.
  • It writes to a single backing index (.ds-logs-nginx-prod-2026.10.20-000002) and reads from all of them.
  • Elastic naming convention: type-dataset-namespace (logs-nginx-prod, metrics-system-default).

2. Templates #

Reusing definitions.

Creation #

PUT _component_template/nginx-mappings
{ "template": { "mappings": { "properties": {
    "@timestamp": { "type": "date" }, "source.ip": { "type": "ip" },
    "http.response.status_code": { "type": "short" }, "url.path": { "type": "keyword" } } } } }

PUT _component_template/logs-settings
{ "template": { "settings": { "index.lifecycle.name": "logs-30d", "number_of_replicas": 1 } } }

PUT _index_template/logs-nginx
{ "index_patterns": [ "logs-nginx-*" ], "data_stream": {}, "priority": 200,
  "composed_of": [ "nginx-mappings", "logs-settings" ],
  "template": { "settings": { "index.default_pipeline": "nginx-access" } } }

PUT _data_stream/logs-nginx-prod          # ou automatiquement au premier document
POST logs-nginx-prod/_rollover            # forcer un nouvel index de backing
Good practice: A template change only applies to new backing indices: change the template, then force a rollover to apply it without waiting.
Common mistake: Index template priority breaks ties between overlapping templates: a low-priority custom logs-* template can be hidden by Elastic's built-in templates (priority 100). Give it a priority above 100 and precise patterns.

📄 Elasticsearch data streams and templates: component templates, index templates and time series →

My progress

  • ⏱ Estimated time : ≈ 4 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.

Authentication

The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).

Authorization

The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.

API Key

A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

Repository

A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...

Elasticsearch

A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.

Recommended Articles

Index Lifecycle Management (ILM): data tiers, rollover and retention

Automate the index lifecycle with ILM: hot, warm, cold and frozen data tiers, rollover by size an...

Transforms and enrich: summarising and enriching data in Elasticsearch

Build entity-centric indices with pivot and latest transforms, and enrich documents at ingest tim...

Elasticsearch ingestion: Bulk API, ingest pipelines, enrich and reindex

Ingest and transform data in Elasticsearch: Bulk API, ingest pipelines and processors (grok, diss...

Elasticsearch best practices: mappings, shards, lifecycle and operations

Elasticsearch best practices: shard sizing, explicit mappings, templates, ILM, JVM memory, securi...

Agent policies, integrations, data streams and pipelines

Build agent policies, add integrations (System, Nginx, Custom Logs), choose namespaces, customise...

OpenTelemetry metrics in Elasticsearch

Collect host, Kubernetes and application metrics with OpenTelemetry, understand temporality and t...

Elasticsearch mappings and text analysis: field types, analyzers and dynamic mapping

Master Elasticsearch mappings: field types (text, keyword, numeric, date, ip, nested), multi-fiel...

OpenTelemetry and Elasticsearch: compatibility and architecture

Send OpenTelemetry to Elasticsearch: Collector and elasticsearch exporter, managed OTLP endpoint,...

Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD

Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!