Elasticsearch & OpenSearch Shard Sizing Calculator

Size primary and replica shards, project total cluster disk capacity, verify JVM heap limits (20 shards/GB rule), and generate ILM rollover policies.

📁 Database🔒 100% Free & Private⚡ Instant Output
Select a standard deployment profile.
Uncompressed raw data indexed daily.
Days
Data lifespan before deletion or snapshot archive.
Number of duplicate copies per primary shard.
GB
Elastic best practice: 10–25 GB for search, 30–50 GB for logs.
Dedicated data nodes in the cluster.
GiB
Standard recommendation: 50% of node RAM, capped at 31 GiB.
%
Elasticsearch stops allocating new shards at 85% disk usage.

Cluster Topology & Shard Distribution Summary

Total Shards in Cluster 220 Shards 110 Primary + 110 Replica
Total Disk Required (with Replicas) 11.61 TB At 85% disk watermark ceiling
Shards Per Data Node 37 Shards Safe distribution across 6 nodes
JVM Heap Shard Headroom 6.0% 37 of 620 max safe shards/node

Cluster Sizing & Hardware Allocation Matrix

Resource Metric Calculated Value Operational Best Practice
Primary Data Volume 4.95 TB 30-day retention with 10% indexing metadata overhead
Raw Storage (with Replicas) 9.90 TB Primary data multiplied by (1 + 1 replica)
Disk Storage Per Node 1.94 TB / node Minimum physical NVMe SSD provisioned per data node
Cluster Safe Shard Capacity 3,720 Shards Calculated as 6 nodes × 31 GB heap × 20 shards/GB
Recommended ILM Rollover max_primary_shard_size: 45gb Index Lifecycle Management rollover directive

Production Index Lifecycle Management (ILM) JSON Policy

{ /* ILM Policy JSON */ }
Quick Overview & Direct Answer

Elasticsearch & OpenSearch Shard Sizing Calculator: Free Elasticsearch & OpenSearch Shard Sizing Calculator tool: calculate Elasticsearch and OpenSearch primary shard counts, replica storage, cluster disk.

Primary Use SQL query optimization, schema formatting, relational data modeling
Input Formats SQL queries, table definitions, CSV/JSON tabular data
Output Format Beautified SQL, conversion dumps, diagram structures
Processing Mode 100% In-Browser Client-Side Processing
Access Tier Free, unlimited, no sign-up needed

The Architecture of Shards in Distributed Search Engines

In distributed search systems such as Elasticsearch and OpenSearch, an index is a logical namespace subdivided into one or more physical partitions called shards. Each shard is a completely self-contained, fully functional Apache Lucene index, with its own inverted index, term dictionary, stored fields, doc values, and segment files.

Choosing an incorrect shard strategy is one of the most common causes of cluster instability:

  • Under-sharding (Shards too large > 50 GB): Massive shards make shard relocation, cluster rebalancing, and node recovery painfully slow. If a node fails, transferring a 100 GB shard across the network can saturate interfaces and trigger cluster timeouts.
  • Over-sharding (Too many small shards < 5 GB): Every single shard consumes JVM heap memory to store Lucene segment metadata. Thousands of tiny shards cause massive JVM garbage collection pauses, exhaust thread pools during distributed searches, and waste enormous compute overhead.

The 20 Shards per GB of JVM Heap Rule

Elastic engineering guidelines mandate maintaining no more than 20 to 25 shards per gigabyte of configured JVM heap on each data node:

$text{Max Shards per Node} = text{JVM Heap (GB)} times 20$

For a standard 31 GB JVM Heap node:

$text{Max Shards} = 31 times 20 = mathbf{620text{ shards per node}}$

Exceeding this ratio causes JVM heap starvation, frequent Stop-the-World garbage collection pauses, and cluster-wide red status during query spikes.

Step-by-Step Worked Numerical Sizing Example

Suppose a DevOps team is designing an Elasticsearch logging cluster for Kubernetes microservices:

  • Daily Ingestion: 150 GB / day
  • Retention Period: 30 days
  • Replica Count: 1 replica (1 primary + 1 replica = 2x copies)
  • Target Shard Size: 45 GB
  • Nodes: 6 dedicated data nodes with 31 GB JVM Heap
  • Disk Low Watermark: 85% ($0.85$)

Step 1: Compute Total Primary Storage Volume:

Raw 30-day Ingestion = $150text{ GB/day} times 30text{ days} = 4,500text{ GB}$

Applying 10% Lucene index metadata overhead = $4,500 times 1.10 = mathbf{4,950text{ GB}}; (mathbf{4.95text{ TB}})$

Step 2: Calculate Required Primary and Total Shards:

$text{Primary Shards} = leftlceil frac{4,950text{ GB}}{45text{ GB}} rightrceil = mathbf{110text{ Primary Shards}}$

$text{Total Shards (with 1 Replica)} = 110 times (1 + 1) = mathbf{220text{ Total Shards}}$

Step 3: Evaluate Shard-to-Heap Ratio:

$text{Shards Per Node} = frac{220text{ Shards}}{6text{ Nodes}} approx mathbf{36.7text{ shards per node}}$

Safe Limit = $31text{ GB Heap} times 20 = 620text{ shards per node}$

Heap Shard Capacity Utilized = $frac{36.7}{620} approx mathbf{5.9%}$ (Excellent headroom)

Step 4: Total Physical Disk Sizing across Nodes:

Total Data with Replicas = $4,950text{ GB} times 2 = 9,900text{ GB}; (9.90text{ TB})$

Factoring 85% Disk Watermark = $frac{9,900text{ GB}}{0.85} approx mathbf{11,647text{ GB}}; (mathbf{11.65text{ TB total}})$

Disk Per Data Node = $frac{11.65text{ TB}}{6text{ Nodes}} approx mathbf{1.94text{ TB per node}}$

The 31 GB JVM Heap Limit: Compressed Ordinary Object Pointers

A frequent trap encountered by system administrators is configuring nodes with 64 GB or 128 GB of RAM and attempting to set -Xmx60g for the JVM heap.

When the heap is strictly under 32 GB (typically capped at 31 GB), modern 64-bit JVMs activate Compressed Ordinary Object Pointers (CompressedOops). CompressedOops shifts memory addresses, allowing 64-bit pointers to be stored as 32-bit values. Setting the heap to 32.5 GB disables CompressedOops, forcing all pointers to expand to full 64-bit values. This increases memory overhead by 30% to 40%, leaving less usable heap than a properly configured 31 GB instance!

Frequently Asked Questions

For logging, metrics, and time-series data (SIEM / observability), Elastic recommends targeting primary shard sizes between 30 GB and 50 GB. For latency-sensitive search workloads (such as e-commerce product catalogs or website search), smaller shard sizes between 10 GB and 25 GB are optimal to prevent slow distributed queries.

Each shard in Elasticsearch consumes memory on the cluster's JVM heap to store Lucene segment metadata, term dictionaries, and in-memory bloom filters. Elastic's strict operational ceiling recommends maintaining no more than 20 to 25 shards per gigabyte of configured JVM heap. A data node with a 31 GB heap should host a maximum of 620 to 775 shards across all indices.

The Java Virtual Machine uses Compressed Ordinary Object Pointers (CompressedOops) on 64-bit systems when the heap is strictly under 32 GB (typically capped at 31 GB). CompressedOops allows pointers to be represented as 32-bit values, doubling object density and saving gigabytes of memory. Allocating 33 GB forces the JVM to switch to uncompressed 64-bit pointers, instantly consuming more memory for worse performance.

ILM automatically rolls over time-series indices based on size or age conditions (e.g. rollover when max_primary_shard_size reaches 50 GB or max_age hits 30 days). This eliminates static calendar-based indices (like daily indices) that often result in thousands of tiny, inefficient 200 MB shards.