Skip to content Skip to footer

How to Build RAG Search That Finds the Right Evidence and Exposes Slow Queries

What Happened

Elasticsearch 9.6 adds ES|QL queries that expose the distribution behind latency histograms, a capability already available in Elastic Cloud Serverless. Its BUCKET and COUNT functions estimate counts within latency ranges; queries can also split those counts by route or chart them over time. This makes it easier to see workloads hidden by a single p95 figure [1].

This is an observability improvement, not evidence of a new retrieval-quality capability. The research does not establish new features or performance comparisons for LlamaIndex, LangChain, Weaviate, Pinecone, Qdrant, Milvus, Vespa, or Haystack.

Why It Matters to Businesses

A RAG application can meet its overall p95 target while particular query types remain consistently slow. Latency distributions segmented by endpoint—and, in a RAG system, by retrieval stage, tenant, or query class—help teams identify where users encounter delays rather than optimizing an aggregate number [1]. Retrieval quality needs separate measurement: faster search does not establish that answers are grounded in the right documents.

Kimbodo Engineering Perspective

Choose a search stack against the application’s needs: access controls, lexical and semantic matching, filtering, update frequency, operating cost, and latency. Frameworks such as LlamaIndex, LangChain, and Haystack can help assemble a pipeline, but they should not obscure which component selected each document or where time was spent. Compare candidate search engines on your own documents and queries rather than assuming vector similarity alone will retrieve the best evidence.

How We Would Implement It

  • Ingest documents with stable IDs, source references, version metadata, and access-control attributes; define how updates and deletions propagate to the index.
  • Retrieve with lexical and vector search where both are useful, apply authorization filters, then rerank a bounded candidate set before generation.
  • Return answer citations linked to retrieved passages. Test retrieval relevance and answer grounding on a representative, permission-aware query set.
  • Trace ingestion, retrieval, reranking, and generation separately. Monitor latency percentiles alongside bucket distributions by stage and query class; investigate persistent slow bands, not just p95 breaches [1].

Risks, Costs and Security

Indexing, embeddings, reranking, and generation each add cost and failure modes. Enforce document permissions before content reaches the model, isolate tenants, and treat retrieved text as untrusted input to limit prompt-injection risk. Histogram bucket counts are estimates, so use them to locate performance problems, then confirm causes with traces and workload tests [1].

Where Kimbodo Comes In

Kimbodo builds and operates this in production for businesses — see our RAG Development Services practice, or Estimate My RAG System.

Sources

  1. [1] Your p95 hides 95% of requests; ES|QL histogram charts don't

Leave a comment

0.0/5

Engineering Founded & Customer Focused

KIMBODO LLC. © 2026. All Rights Reserved.