Elasticsearch rejects requests with circuit_breaking_exception: Data too large
circuit_breaking_exceptionShort 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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
The parent breaker shows trips, and heap.percent stays high in _cat/nodesJVM heap pressure is high on one or more nodesFix - 2
The 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
The error comes in bursts: big aggregations or searches run togetherMany heavy operations run in parallelFix
- 1
What does the error look like?
circuit_breaking_exceptioncircuit_breaking_exception with a reason that contains Data too largeHTTP 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
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
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
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
Databases
Node.js in Docker Compose cannot find mysql2/promise
The app works on the host but fails after docker compose up
mysql2/promise is a path inside the mysql2 package.
2 causes, each with a fixDatabases
JupyterLab cannot determine its build status without Node.js
Could not determine jupyterlab build status without nodejs
JupyterLab itself runs without Node.js, but source extensions need Node.js to rebuild it.
3 causes, each with a fixDatabases
Mongoose cannot sign in to MongoDB Atlas: bad auth, authentication failed
MongoError: bad auth Authentication failed.
Authentication failed means the server rejected the user in your connection string.
3 causes, each with a fixDatabases
MongoDB says duplicate key, but the value is null
MongoServerError: E11000 duplicate key error
A unique index in MongoDB stores a missing field as null, and only one null entry is allowed.
3 causes, each with a fixDatabases
mongodb-memory-server will not start under Jest or in Docker
NoSystemBinaryFoundError
When mongodb-memory-server fails to start, the real reason is hidden behind a generic message.
4 causes, each with a fixDatabases
updateOne() runs without an error but the document does not change
{ "acknowledged" : true, "matchedCount" : 0, "modifiedCount" : 0 }
updateOne() reports what it did in its result.
4 causes, each with a fix