Elasticsearch High JVM Memory Pressure and Out of Memory

Share
Workaround available Self-hosted, Elastic Cloud Updated November 15, 2026Based on 2 user reportsHow we research

Quick answer

Sustained memory pressure above 85% slows searches and triggers circuit breakers or node crashes. The usual causes are too many shards, oversized heaps, swapping and heavy aggregations.

Most likely fix: Check the right metric

How to fix it

Try these in order — the most common fix is first.

  1. 1. Check the right metric

    1. Track old-generation usage as a rolling average, not instant heap percent
    2. Healthy GC: young under 50 ms about every 10 s, old under 1 s no more than once per 10 min
    Did this fix it?
  2. 2. Fix heap and OS settings

    1. Let Elasticsearch size the heap by default; if manual, Xms equals Xmx and at most half of RAM
    2. Disable swap on the OS
    3. Verify compressed OOPs are enabled
    Did this fix it?
  3. 3. Cut memory consumers

    1. Consolidate into fewer, larger shards
    2. Force merge or use an ILM force merge action after writes stop
    3. Lower index.max_result_window and search.max_buckets, set a default search timeout
    Did this fix it?
  4. 4. Scale if the workload outgrew the hardware

    1. Add node memory or nodes
    2. Enable AutoOps or stack monitoring alerts on JVM memory
    Did this fix it?

Symptoms

Nodes go slow, long GC pauses in logs, nodes drop out of the cluster, circuit breaker errors, occasionally OutOfMemoryError.

Why it happens

  • Too many shards or segments
  • Swap enabled
  • Heap set above about 30 GB, which disables compressed OOPs
  • Heap larger than half of system RAM
  • Expensive aggregations, large result windows or bulk requests
  • Mapping explosion

This guide also covers

  • elasticsearch high jvm memory pressure
  • elasticsearch out of memory
  • elasticsearch heap size too high

Still not working?

If Elasticsearch keeps failing, you're not alone. See every Elasticsearch problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All slow, laggy or resource-hungry guides →

Other Elasticsearch errors

All 10 Elasticsearch errors and fixes →