Elasticsearch / Editorial solution guide

Diagnose slow search and memory rejections

Classify request cost and pressure without disabling breakers or masking incomplete responses.

About 3 min readContent reviewed

Read-only knowledge base · No public comments

Recognize the symptoms

Catalog search latency rises with concurrency, an aggregation reports circuit_breaking_exception or too_many_buckets_exception, or clients receive execution rejections. A request can also return some hits with timed_out or failed shards. Capture the exact request class and measurement boundary before calling every symptom a server timeout.

Understand the likely causes

  • Deep offsets, high-cardinality buckets, nested expansion, scripts, broad source retrieval and concurrent ingestion compete for finite resources. Breakers protect selected memory demands, while execution queues express acceptance pressure. A larger limit or a rapid retry loop adds no CPU, disk or memory capacity.

Separate response completeness from response speed

Inspect timed_out, shard failures, item errors and total-hit relation along with elapsed time. A nonempty hit list does not prove a complete answer, and a lower-bound hit count should not be displayed as exact. Determine whether delay occurs in server processing, network transfer or client deserialization. Keep a representative query and parameter set for each workload class rather than comparing unrelated requests. Redact visitor text and sensitive document fields from shared evidence. No load test is needed to establish the request’s intended semantics.

Remove work the product does not require

Review requested page depth, source fields, exact total counting and aggregation breadth. The bounded example returns only identifiers and titles, with no total-hit count. It is appropriate only if the UI accepts that contract. If users need all category keys, use a reviewed complete traversal rather than raising a top-terms size indefinitely. If they need only a top-five facet, preserve the approximation metadata rather than pretending the result is an audited inventory.

json Illustrative technical example; logical results are reasoned, not engine-tested.
{"size":10,"track_total_hits":false,"query":{"term":{"status":"displayed"}},"_source":["artifact_id","title"],"sort":[{"artifact_id":"asc"}]}

A narrower response contract, not proof of measured improvement. artifact_id and status are assumed keyword fields.

Use rejection as backpressure evidence

Preserve the detailed breaker or rejection reason and approved contemporaneous metrics. Do not disable a breaker merely to make the error disappear; its tracking is already incomplete protection. Reduce offered concurrency and retry only eligible idempotent work with bounded backoff. The local model shows how in-flight payload exposure multiplies, while excluding all engine overhead. It cannot size a node or justify changing heap. Include ingestion and recovery work when interpreting a search-only latency observation.

json Illustrative technical example; logical results are reasoned, not engine-tested.
{"request_payload_mib":6,"in_flight_requests":5,"payload_exposure_mib":30,"excluded":["parsed structures","engine state","responses"]}

A local multiplication model: 6 × 5 = 30 MiB. It is not Elasticsearch configuration or measured heap usage.

Choose one evidence-backed performance hypothesis

Inspect authorized CPU, heap pressure, garbage collection, disk, filesystem cache, queueing and shard distribution. Profile selected synthetic requests only when approved, remembering diagnostic overhead and scope limits. A script-heavy query, oversized response and recovery-saturated disk need different remedies. Compare representative requests after one justified change and preserve relevance and count correctness. Self-managed node controls do not apply directly to Serverless, and no single shard size, heap percentage or request concurrency is universally correct.

Verify the fix

Verify the same request population at the same observation boundary, including partial-result handling and per-item rejection accounting. Compare accepted useful work rather than sender throughput alone. This guide performed only local JSON and arithmetic checks, with no cluster benchmark or setting change.

Keep it from recurring

  • Publish bounded query templates, pagination and aggregation budgets, explicit incomplete-result behavior and producer backpressure. Review cost and relevance together whenever a new search feature expands candidate or response breadth.

Official references