Skip to content

Troubleshooting guide

Elasticsearch CircuitBreakingException: how to fix it

Elasticsearch rejected the request because completing it would have risked running out of heap. It is a safety mechanism: it failed one request to save the node.

3 min read10 sectionsUpdated

On this page

Key points

  • The message names which breaker tripped.
  • The parent breaker covers real heap in use.
  • Fielddata on text fields is a classic cause.
  • Do not disable breakers.

What it means

Before allocating memory, Elasticsearch estimates the cost and checks it against breakers: parent (95 percent of heap by default with real-memory tracking), request, fielddata and in-flight requests. If the limit would be crossed, it returns HTTP 429 with this exception.

Common causes

  • Huge aggregations, such as a terms agg with enormous size or high cardinality.
  • Sorting or aggregating on text fields with fielddata turned on.
  • Too many shards per node.
  • Heap that is too small, or under long GC pressure.
  • Oversized bulk requests.

Diagnose it

See which breaker is close to its limit, and what is using heap.

bash
# Breaker usage, limits and trip counts
curl -s localhost:9200/_nodes/stats/breaker?pretty | grep -E '"(parent|fielddata|request)"|estimated_size"|limit_size"|tripped'

# Heap per node
curl -s 'localhost:9200/_cat/nodes?v&h=name,heap.percent,heap.max,ram.percent'

# Fielddata use by field
curl -s 'localhost:9200/_cat/fielddata?v'

# Shards per node
curl -s 'localhost:9200/_cat/allocation?v&h=node,shards'

Fixes

Aggregate on keyword fields with doc values and not text. Reduce aggregation size, use a smaller time range, or use composite aggregations for paging. Keep heap at about half of RAM and below roughly 31 GB, so compressed object pointers stay enabled. Reduce the number of shards. Break bulk requests into 5 to 15 MB batches, and retry on 429 with backoff.

Fielddata explained

Doc values store column data on disk and are the default for keyword and numeric fields. text fields have none, so sorting or aggregating on them loads an in-memory structure called fielddata, which can be very large. It is disabled by default for that reason. If someone enabled it to make a dashboard work, that setting is the likely source of the trouble. The usual fix is a multi-field mapping with a .keyword subfield, and reindexing. Clear the cache in an emergency using POST _cache/clear?fielddata=true.

Catch it automatically

Alert on breaker trip counts and sustained heap above 85 percent using Elasticsearch monitoring. Log which query caused each 429, as a single dashboard often accounts for all of them.

Frequently asked questions

Can I raise the breaker limits?

You can, but the risk is an out-of-memory crash, which is much worse than a rejected request.

Why not use a 64 GB heap?

Above about 31 GB the JVM loses compressed pointers, so usable capacity can actually fall.

Is 429 here retryable?

Yes, with backoff, once the memory pressure has eased.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.