On a VPS, Elasticsearch storage is decided by three numbers: how much indexed data you add per day, how many days you keep, and how many copies of each shard you hold. Elastic recommends shards between 10 GB and 50 GB, and index lifecycle management (ILM) can roll over and delete indices automatically, so the job is to pick a rollover size and a retention period that keep shard count low and leave enough free disk for merges and resizing.
Our earlier Elasticsearch VPS sizing guide covers JVM heap limits, page cache and disk watermarks. This post covers the shard and retention side.
What drives storage and memory
- Indexed size per day. Raw log size is a poor guide; mappings, analysers and compression change it. Index one representative day and read the size from
GET _cat/indices?v. - Retention. How many days of data must be searchable.
- Replicas. Each replica doubles the disk used by its primary. On a single-node cluster, replicas cannot be allocated to another node, so they stay unassigned.
- Shard count. Every shard and every mapped field costs heap, whether or not anyone searches it.
Elastic's sizing rules, in one place
| Rule | Value from the Elastic documentation |
|---|---|
| Target shard size | Between 10 GB and 50 GB |
| Documents per shard | Below 200 million (Lucene's hard limit is 2,147,483,519) |
| ILM rollover settings | max_primary_shard_size: 50gb, min_primary_shard_size: 10gb |
| Master-node heap | At least 1 GB per 3,000 indices |
| Shards per node | Capped at 1,000 non-frozen shards |
| Data-node heap estimate | Mapping overhead plus per-field overhead plus about 0.5 GB |
The heap formula is worth a closer look. Elastic's example adds 1 GB of cluster-state mapping overhead, 1 GB of per-field overhead and 0.5 GB of baseline to reach 2.5 GB, which fits a 4 GB heap. You can read the real overheads from the cluster stats and nodes stats APIs once data is loaded.
Setting up ILM for time-series data
ILM moves indices through up to five phases (hot, warm, cold, frozen and delete) and can run actions such as rollover, shrink, force merge and delete. On a single VPS you rarely need warm or cold tiers; hot and delete are enough:
PUT _ilm/policy/logs-30d
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb",
"min_primary_shard_size": "10gb",
"max_age": "7d"
}
}
},
"delete": {
"min_age": "30d",
"actions": { "delete": {} }
}
}
}
}Attach the policy to a data stream through its index template. Elastic advises against rollover on max_age alone, because quiet periods then create many small or empty indices; pairing it with the size conditions avoids that.
Worked example
A SaaS team in its first year indexes 6 GB of application logs per day, must keep 30 days, and runs one node with one primary shard per backing index.
- Data on disk: 6 GB x 30 days = 180 GB of primaries. No replicas on one node.
- Shard size: rollover at 50 GB would take about eight days, so with
max_age: 7deach shard ends near 42 GB, inside the 10 to 50 GB range. Only five or six backing indices exist at a time. - Headroom: shrinking or reindexing an index needs room for a full copy, and merges need temporary space. Plan for at least one extra shard's worth (around 50 GB) on top of disk watermarks, so roughly 260 GB or more of usable disk.
- Heap: a few dozen shards and a modest mapping fit comfortably in a 4 GB heap by Elastic's formula, leaving the rest of RAM to the file-system cache.
If the same team kept 90 days, primaries would reach 540 GB. At that point a second and third node, with one replica each, is the safer design, both for disk and so a single failure does not take search offline.
Keeping storage under control
- Delete indices, not documents. Elastic notes that deleted documents keep using resources until a segment merge removes them, whereas deleting an index frees space at once.
- Force merge read-only indices during quiet hours to cut segment count.
- Shrink or reindex small indices, for example daily indices into monthly ones, then delete the originals.
- Trim mappings. Remove fields nobody searches; consider runtime fields for rarely used ones.
- Spread busy indices with
index.routing.allocation.total_shards_per_nodeonce you have several nodes.
When to upgrade
Fixing oversized shards means copying the index with split or reindex, because shards are immutable, so you need free disk before you need it. Move up a plan when disk use passes your headroom line, when heap stays high after a merge, or when query latency grows with retention. StreamData's KVM VPS plans run from 1 GB to 128 GB of RAM on RAID NVMe storage; the 9950X VPS plans add 16 to 64 GB of DDR5 with 64 to 256 GB of NVMe; and dedicated servers suit clusters that need more disk per node. Backups are your responsibility unless your order includes them, so register a snapshot repository on separate storage.