Lower-cost, faster search
Optimized Elasticsearch queries, index mappings, and cache behavior as part of the search cost program.
- Role
- Engineer in Charge · Queries & Index Mappings
- Delivery
- Iterative Query, Index & Cache Improvements
- Tech Stack
- Go · Elasticsearch · Redis
- Impact
- $288K/year Annualized Elasticsearch Savings
The Problem
Expensive queries, unnecessary indexed fields, and oversized cache keys were increasing the operating cost of search. The changes needed to preserve relevance and production behavior while reducing infrastructure work.
The Architecture
Reduce unnecessary work
Removed unneeded indexing and query costs while checking the queries used by downstream services.
Cache deliberately
Changed cache granularity and expiry behavior, then addressed the memory trade-off with hashes and shorter keys.
Preserve behavior
Used comparison scripts, testing, and coordinated production execution for version and mapping changes.
The Execution
Engineering PIC for non-performing-product and index-mapping initiatives within the Elasticsearch cost optimization program. My related work improved cache efficiency and supported Elasticsearch upgrades and cluster scaling.
What I owned
- PIC for non-performing-product and index-mapping initiatives, coordinating mapping reviews, scripts, testing, and migration plans.
- Implemented cache changes and reusable Redis abstractions with optional circuit breakers, metrics, and pipeline support.
- Worked with platform and search engineers on scaling, mitigation plans, and production execution.
Technical impact
- Reviewed 64 potential Elasticsearch queries or fields and finalized index-mapping changes. The overall program freed 192 CPU cores.
- The 2023 record describes search endpoint latency changing from peaks of 370 ms to a stable approximately 100 ms. These are different measurement descriptions, not a like-for-like percentile benchmark.
- Introduced partial caching and expiry jitter, then Redis hashes and shorter keys. A separate 2022 comparison reported average p95 Elasticsearch latency falling from 168 ms to 152 ms.
- Led the search service’s Elasticsearch 6-to-7 migration and participated in or executed four cluster-scaling operations.
The Result
- Annualized Elasticsearch Savings
- $288K/year
$24K/month × 12 · Combined team program
- Elasticsearch Monthly Spend
- −40%
Same team optimization program
- Lower Redis Memory Usage
- 11–21%
Filter-cache improvement
Business impact
- The combined Elasticsearch optimization program reported a 40% reduction in monthly spend, equivalent to $24,000 per month or $288,000 per year when annualized. The annual figure is calculated from the monthly rate, rather than a separately reported full-year total.
- Cache improvements reduced reported Redis memory usage by 1.7–3.3 GB and removed related critical memory alerts during the observed period.
The Takeaway
I connect performance work to infrastructure cost and production behavior, including the trade-offs introduced by an optimization.