Problem
Elastic's Field Engineering team built a support chatbot that answers from a base of over 300,000 knowledge articles and crawled documentation pages. Only the top 3 results go to the LLM because of the token limit of the GPT-4 deployment. Queries with exact identifiers (CVE numbers, product versions) returned poor results. With the wrong context, the model said the asked versions "had not been released" or covered only one of three CVEs.
Example from the article: "Can you compare Elasticsearch versions 8.14.3 and 8.14.2?" returned two Apache Hadoop pages and an APM page.
Solution in brief
Treat RAG quality as a search problem and fix each failure at its source. Conditional boosts on the title and version fields fix identifier queries, LLM-generated summary fields fix weak embeddings, and collapse removes duplicate versions of one page. Precision@3 on 12 curated queries measured the gain.
Questions this case answers
- How to improve the precision of the few retrieved passages given to an LLM when queries contain exact identifiers that semantic matching misses
- How to quantify the gain of a retrieval change before release using a small curated set of queries with known relevant documents
- How to tune hybrid keyword and semantic search so a RAG support chatbot retrieves the right documents for CVE and version questions?
- How to stop near-identical versions of the same documentation page from filling the top results fed to an LLM?
Tools and methods
- Hybrid search (BM25 + ELSER) — keyword and sparse semantic queries in one
bool.should. - Conditional boosting — extra weight on
titlefor CVEs, onversionfor docs. - GPT-4 enrichment service — generates summary, questions and tag fields.
collapseon a slug field — keeps the best version of each page.- Ranking Evaluation API, Precision@K — scores curated queries before and after.
Google or a one-time email code. No password.