How a dedicated Elasticsearch index cut autocomplete latency from 5s to milliseconds
A developer building autocomplete over 100 million documents discovered that slow first-call response times of around 5 seconds were caused by a cold-start pipeline, including JIT compilation, HTTP/TLS connection pooling, and loading Lucene segments into memory. Initial benchmarks run on a local dataset were misleading, as database enrichment dominated response times locally, while on the full production-scale environment it was the Elasticsearch aggregation query itself that became the bottleneck. Prefix match, Edge N-gram, and Search As You Type patterns all required a costly terms aggregation to deduplicate results, which proved unacceptably slow at scale. The investigation highlighted that testing autocomplete performance requires production-scale data volumes to identify the true bottleneck. The findings pointed toward adopting a dedicated index strategy to shift work to index-time rather than query-time, dramatically reducing search latency.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in