RousselTMLEARNING

Article · Elasticsearch: from discovery to expertise

Data streams and templates

This article is available in French.

1. Principe #

Un nom, plusieurs index.

Architecture #

Data stream et templates
  • Un data stream est un nom logique (logs-nginx-prod) pour des données horodatées en ajout seul ; il exige un champ @timestamp.
  • Il écrit dans un seul index de backing (.ds-logs-nginx-prod-2026.10.20-000002) et lit dans tous.
  • Convention de nommage Elastic : type-dataset-namespace (logs-nginx-prod, metrics-system-default).

2. Templates #

Réutiliser les définitions.

Création #

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
Bonne Pratique : Une modification de template ne s'applique qu'aux nouveaux index de backing : changez le template, puis forcez un rollover pour l'appliquer sans attendre.
Erreur Courante : La priorité des index templates départage les modèles qui se recouvrent : un template personnalisé logs-* de priorité basse peut être masqué par les templates intégrés d'Elastic (priorité 100). Donnez une priorité supérieure à 100 et des motifs précis.

📄 Data streams et templates Elasticsearch : component templates, index templates et séries temporelles →

My progress

  • ⏱ Estimated time : ≈ 4 min

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

✉️ Ask a question

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

Understanding the concept of score

The concept of score allows Elasticsearch to rank your documents by relevance during a search.

Understanding the Elastic Common Schema (ECS)

As always in our consulting engagements, we recommend that companies harmonise and standardise: k...

License consumption types

Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...

Grafana Alloy: The importance of Self-Monitoring

Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...

Grafana Alloy: Understanding and exploiting the User Interface (UI)

Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...

Grafana Alloy: Introduction and Architecture

Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...

Grafana Alloy: Syntax and Configuration (Alloy Language: River)

As part of a Grafana training or observability training, master the declarative syntax of Grafana...

Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)

Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...

Grafana Alloy: Log Management with Loki

Discover how to configure Grafana Alloy to read log files, journald, or network streams, process ...