Building an Enterprise RAG-based AI Assistant with Vector Search and LLM Integration

elastic · Tech · 2025 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Enterprise knowledge assistant

Elastic needed an internal GenAI assistant that could answer employee questions from trusted internal data while preserving privacy, search quality, logging, and enterprise deployment controls.

Constraints:

Architecture

ElasticGPT uses SmartSource, a RAG framework backed by Elasticsearch vector search and storage. LangChain chunks internal Wiki and ServiceNow data, generates embeddings, retrieves relevant context from Elasticsearch, and crafts prompts for GPT-4o or GPT-4o-mini hosted on a dedicated Azure tenant. Kubernetes in Elastic Cloud hosts the application, while Elasticsearch logs chat interactions and deletes user chat data after 30 days.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  employee[Employee] --> elasticgpt[ElasticGPT]
  elasticgpt --> smartsource[SmartSource]
  smartsource --> elasticsearch-vector-store[Elasticsearch Vector Store]
  smartsource --> langchain-pipeline[LangChain Pipeline]
  langchain-pipeline --> openai-azure-tenant[OpenAI Azure Tenant]
  elasticgpt --> elasticsearch-chat-store[Elasticsearch Chat Store]
  elastic-cloud-kubernetes[Elastic Cloud Kubernetes] --> elasticgpt[ElasticGPT]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Employee Elastic user asking internal knowledge questions. ElasticGPT
ElasticGPT Internal generative AI assistant interface. SmartSource, Elasticsearch Chat Store
SmartSource RAG retrieval layer for internal data sources. Elasticsearch Vector Store, LangChain Pipeline
LangChain Pipeline Handles chunking, embedding, retrieval context, and prompt construction. Elasticsearch Vector Store, OpenAI Azure Tenant
Elasticsearch Vector Store Stores embeddings and powers semantic/vector retrieval. SmartSource, LangChain Pipeline
OpenAI Azure Tenant Dedicated GPT-4o and GPT-4o-mini model hosting. LangChain Pipeline
Elasticsearch Chat Store Logs interactions and retains metrics under deletion policy. ElasticGPT
Elastic Cloud Kubernetes Hosts the application in Elastic's cloud environment. ElasticGPT

Data flow

Internal data is chunked and embedded into Elasticsearch. When a user asks a question, SmartSource retrieves relevant context, LangChain builds the prompt, OpenAI models generate the answer, and Elasticsearch stores chat logs and metrics under a retention policy.

“Using Elastic’s Enterprise Connectors, we ingest this data effortlessly, break it into searchable chunks, and generate embeddings for semantic search.”article, stated
“retrieves and passes the most relevant context from our internal data sources to an OpenAI large language model”article, stated

Why this architecture

Elastic chose Elasticsearch as both vector/search backbone and chat repository because the assistant's core requirement was retrieval over internal knowledge plus auditable, privacy-aware logging. LangChain supplied the RAG orchestration around chunking, embeddings, retrieval, and prompt construction.

“serves as both the vector database for SmartSource’s RAG capabilities and a robust repository for chat data across all models”article, stated
“LangChain manages the RAG pipeline end-to-end: chunking ingested data, generating embeddings, retrieving context from Elasticsearch”article, stated

Models used: GPT-4o · GPT-4o-mini · OpenAI embeddings

Scale

Alternatives considered (roads not taken)

Use Hugging Face Chat UI as the primary interface.

Rejected because: Elastic switched to EUI to better fit internal product patterns.

“Early on, we toyed with Hugging Face’s Chat UI for a quick start, but its limitations became clear when users demanded custom features. Switching to EUI was a no-brainer — it’s purpose-built for Elastic’s products, aligning perfectly with our design system and backend.”article, stated

Use a generic chatbot without internal retrieval.

Rejected because: The assistant needed SmartSource to retrieve trusted internal context.

“assistant built on a retrieval augmented generation (RAG) framework.”article, stated

Store chat data without a retention boundary.

Rejected because: Elastic chose 30-day deletion for user chat data, retaining only metrics.

“application performance monitoring (APM) keeps tabs on performance, reliability, and resource utilization, ensuring response times stay lightning-fast as adoption scales. User chat data is deleted every 30 days, with only metrics saved, enabling us to retain the most relevant data cost”article, stated

Patterns

rag-retrieval (knowledge)

SmartSource retrieves internal context before the model generates responses.

“At its heart lies SmartSource”article, stated

retrieval-ranking (search)

Elasticsearch vector search retrieves relevant chunks from embedded internal data.

“using Elasticsearch for vector search and data storage”article, stated

privacy-preserving-processing (governance)

Chat content is retained only temporarily while metrics persist.

“User chat data is deleted every 30 days, with only metrics saved”article, stated

observability-tracing (operations)

Every interaction is logged in Elasticsearch for analysis and operations.

“Every interaction — whether with SmartSource, GPT-4o, or GPT-4o-mini — is meticulously logged in Elasticsearch.”article, stated

Tradeoffs

Search backbone

Chose Elasticsearch for vector search and chat storage over Separate vector database and logging store.

Rationale: One platform could serve retrieval and chat repository needs.

“serves as both the vector database for SmartSource’s RAG capabilities and a robust repository for chat data across all models”article, stated

Interface stack

Chose EUI-aligned internal UI over Hugging Face Chat UI.

Rationale: Elastic needed a UI consistent with its ecosystem and internal deployment.

“Hugging Face’s Chat UI for a quick start, but its limitations became clear when users demanded custom features.”article, stated

Model hosting

Chose Dedicated Azure tenant for OpenAI models over Unscoped public model access.

Rationale: Enterprise use required private, secure model access.

“private, secure access to OpenAI’s GPT-4o and GPT-4o-mini models hosted on a dedicated Azure tenant”article, stated

Gotchas (what bit them)

Chat UI choice can become a product-integration problem.

Root cause: A generic UI may not match the organization's design and support expectations.

Resolution: Switch from Hugging Face Chat UI toward Elastic UI.

“Switching to EUI was a no-brainer — it’s purpose-built for Elastic’s products”article, stated

Enterprise assistant logs need retention limits.

Root cause: Employee chats can contain sensitive internal information.

Resolution: Delete user chat data after 30 days and retain only metrics.

“User chat data is deleted every 30 days, with only metrics saved”article, stated

Evaluation

Elastic evaluates ElasticGPT through interaction logs, saved metrics, adoption of internal knowledge retrieval, and operational effects such as reducing redundant IT questions.

Metrics: Chat interaction metrics · IT query reduction · Employee efficiency · Data retention compliance · Retrieval coverage

“slashing redundant IT queries and creating employee efficiencies”article, stated

Outcomes

The source reports a 30-day chat retention period, Kubernetes hosting in Elastic Cloud, and internal sources including Elastic Wiki and ServiceNow knowledge/news articles.

“ElasticGPT is our internal generative AI (GenAI) assistant”article, stated