Elasticsearch Reliability & Downtime Reduction Plan
Status: Priority / Backend + FE staging QA
Date: 2026-07-23 (updated 2026-07-28)
API contract (authoritative)
| Item | Value |
|---|---|
| Primary signal | HTTP 503 |
| Header | X-Search-Available: 0 (bonus; CORS-exposed) |
| Body message | Search is temporarily unavailable. Please try again shortly. |
| Never | 200 + empty list for ES downtime |
Applies to: /product/search, /autocomplete, /product/autocomplete, product dynamic filters, other ES-backed listing endpoints.
FE CORS note
X-Search-Available is in Access-Control-Expose-Headers (same as X-Pagination-*).
Force degraded mode (staging QA)
- On staging API host set in
params-local.php:'allowForceSearchUnavailable' => true, - Call any search/autocomplete/filter URL with:
- query:
?forceSearchUnavailable=1 - or header:
X-Force-Search-Unavailable: 1
- query:
- Expect 503 +
X-Search-Available: 0 - Retry without the flag → normal 200 when ES is healthy
Keep allowForceSearchUnavailable false in production.
Backend changes shipped
- ES timeouts + spool lock recovery + health-check cron command
- API ErrorHandler → 503 + header
- CORS expose
X-Search-Available - Autocomplete returns same 503 (not empty 200) on ES downtime
- Staging force-degrade flag for QA
Related documentation
- Search Functionality — customer search behaviour and endpoints
- Elasticsearch Spool — indexing queue and recovery
- Gap: OP-004 Search Functionality
- Gap: CP-001 Elasticsearch Spool