Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

Elasticsearch rejects requests with circuit_breaking_exception: Data too large

Errorcircuit_breaking_exception

Short answer

A circuit_breaking_exception with 'Data too large' means Elasticsearch refused work to protect a node's JVM heap. The parent breaker trips by default at 95% of the heap. Check which breaker tripped with the node stats API, then lower heap pressure or stop fielddata on text fields.

  • Applies to Elasticsearch 8.x, Elasticsearch 9.x, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the cluster which breaker has tripped and how close each node is to its limit.

    curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"
    curl -s "http://localhost:9200/_cat/nodes?v&h=name,heap.percent"
  2. 2Match what you see, then jump to its fix

    1. 1The parent breaker shows trips, and heap.percent stays high in _cat/nodesJVM heap pressure is high on one or more nodesFix
    2. 2The fielddata breaker is the one that tripped, after a query that sorts or aggregates on a text fieldFielddata is loaded on a high-cardinality text fieldFix
    3. 3The error comes in bursts: big aggregations or searches run togetherMany heavy operations run in parallelFix

What does the error look like?

  • circuit_breaking_exception
  • circuit_breaking_exception with a reason that contains Data too large
  • HTTP 429 from Elasticsearch

Cause 1 of 3

JVM heap pressure is high on one or more nodes

1Check

Elastic's troubleshooting page says the parent breaker triggers at 95% JVM memory usage by default and that heap use consistently above 85% needs action. It points to its High JVM memory pressure guide.

curl -s "http://localhost:9200/_cat/nodes?v&h=name,heap.percent,heap.max"

2Fix

Follow Elastic's guide for high JVM memory pressure on the nodes that show it. Elastic's own page does not give a one-line setting, so do not raise breaker limits to hide the cause.

# re-check after changes
curl -s "http://localhost:9200/_cat/nodes?v&h=name,heap.percent"

3Verify

heap.percent stays below the level the guide calls a problem during normal load.

curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"

Confirmed by elastic.co

Did this fix it?

Cause 2 of 3

Fielddata is loaded on a high-cardinality text field

1Check

The troubleshooting page lists fielddata on high-cardinality text fields as a cause, and recommends a keyword field instead.

curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"

2Fix

Aggregate and sort on a keyword field and not on the text field. If you cannot change the query now, clear the fielddata cache: the page warns this may disrupt in-flight searches.

curl -X POST "http://localhost:9200/my-index/_cache/clear?fielddata=true"

3Verify

Re-run the query that failed, using the keyword field.

curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"

Confirmed by elastic.co

Did this fix it?

Cause 3 of 3

Many heavy operations run in parallel

1Check

The same page lists aggregations, complex queries and parallel operations that exhaust heap as a cause. The circuit breaker settings page notes breakers track only part of memory use.

curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"

2Fix

Spread or queue the heavy requests in your Node.js client, so only a few run at once, and retry a rejected request later instead of resending it at once. A small concurrency limit in your own code is enough to test this.

// run at most 2 heavy searches at a time
let running = 0;
async function limited(fn) {
  while (running >= 2) await new Promise(r => setTimeout(r, 200));
  running++;
  try { return await fn(); } finally { running--; }
}

3Verify

The burst completes and the trip count stops growing.

curl -s "http://localhost:9200/_nodes/stats/breaker?pretty"

Confirmed by elastic.co

Did this fix it?

How do I stop it coming back?

  • Alert on heap.percent per node before it reaches the level Elastic's guide calls a problem.
  • Map fields you sort or aggregate on as keyword, and not as text.
  • Limit how many heavy searches your Node.js services send at once.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.