1. Shards #
The first factor.
Sizing #
- Aim for 10 to 50 GB per primary shard for logs; rollover by
max_primary_shard_sizeguarantees it. - Too many small shards: heavy cluster state, wasted memory and queries. Default limit: 1,000 shards per node (
cluster.max_shards_per_node). - Number of primaries for a high-throughput index: around the number of hot data nodes, to spread writes.
2. Memory and indexing #
The settings that matter.
Settings #
| Setting | Recommendation |
|---|---|
| JVM heap | ≤ 50% of RAM (the rest is used by the file system cache, essential to Lucene) and under ~31 GB |
refresh_interval | 30 s or more for logs (1 s by default): fewer segments, faster indexing |
| Initial load | number_of_replicas: 0 and refresh_interval: -1, then restore |
| Bulk | 5 to 15 MB per request, several clients in parallel, watch for rejections |
| Fields | No unnecessary text fields; index: false on fields never searched |
| Disks | Local SSDs for the hot tier |
3. Measuring #
Capacity planning.
Benchmark #
pip install esrally
esrally race --track=http_logs --target-hosts=es01:9200 --pipeline=benchmark-only \
--client-options="use_ssl:true,verify_certs:false,basic_auth_user:'elastic',basic_auth_password:'$ES_PASSWORD'"- Measure indexing throughput and search latency on one node with your data (or a similar Rally track).
- Derive the number of hot nodes for the target throughput, with a 30% margin.
- Compute storage: daily volume × (1 + replicas) × retention per tier × index factor (often 1.1 to 1.5 compared with raw data).
- Revalidate at each major version or mapping change.
Common mistake: Never run a Rally benchmark on a production cluster: it creates its own indices and saturates the cluster.
My progress
Sign in to track your progress and take notes. Sign in
💬 Recent discussions about this course
- Elasticsearch : supprimer automatiquement les logs de plus de 30 jours✓ solved · 1 reply(ies)
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
Elasticsearch monitoring and troubleshooting: health, unassigned shards, JVM, hot threads and slow logs
Diagnose an Elasticsearch cluster: cluster health and CAT APIs, unassigned shards and allocation ...
Elasticsearch best practices: mappings, shards, lifecycle and operations
Elasticsearch best practices: shard sizing, explicit mappings, templates, ILM, JVM memory, securi...
OpenSearch performance, sizing and troubleshooting
Sizing and optimizing an OpenSearch cluster: shard size and count, bulk indexing, refresh and tra...
Elasticsearch distributed architecture: node roles, shards, replicas and allocation
Understand how Elasticsearch works as a distributed system: node roles, master nodes and quorum, ...
The OpenSearch cluster in depth: nodes, shards and replication
Understanding how an OpenSearch cluster works inside: node roles, cluster manager election, shard...
Cross-cluster search and cross-cluster replication: multi-cluster Elasticsearch architectures
Design multi-cluster Elasticsearch architectures: remote clusters, cross-cluster search, cross-cl...
Grafana Loki vs Elasticsearch: the battle of log storage
A comparison between Loki, the Prometheus-inspired log system, and Elasticsearch, the reference f...
Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD
Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...
OpenSearch: concepts, architecture and differences with Elasticsearch
Understanding OpenSearch: project origin, license, differences with Elasticsearch, indexes, shard...