Skip to content Skip to footer

How to Build RAG Search That Respects User Permissions and Survives Platform Upgrades

What Happened

Two recent changes highlight operational requirements for retrieval-augmented generation (RAG). Amazon Bedrock AgentCore Gateway can call Elasticsearch tools using each signed-in user’s OAuth identity rather than a shared API key. Elastic roles then determine which indices the agent can access. The integration uses an OAuth MCP client and an MCP server target configured for version 2025-11-25. [1]

Vespa is moving its Docker images from AlmaLinux 8 to AlmaLinux 9 and its bundled JDK from 17 to 21. Vespa 8.797 is the last release whose latest and 8 tags use AlmaLinux 8. Teams running self-managed Vespa should test Java components, JVM options and native libraries before upgrading. [2]

Why It Matters to Businesses

A RAG answer is only as safe as the retrieval call behind it. If an agent searches with a shared credential, application-level filtering becomes the main barrier between a user and another team’s documents. Per-user authorization moves that decision to the search system’s existing roles; it does not remove the need to validate what the agent returns. [1]

Search infrastructure is also part of the production application, not a disposable prompt dependency. An image or JDK change can affect ingestion and query services even when the retrieval design has not changed. [2]

Kimbodo Engineering Perspective

We would treat LlamaIndex, LangChain and Haystack as orchestration choices, and Weaviate, Pinecone, Qdrant, Milvus, Elasticsearch and Vespa as retrieval-platform choices—not assume that selecting one of either category solves authorization, relevance or operations. The practical selection criteria are the required search modes, permission model, filtering behavior, latency, deployment constraints and operating cost.

Per-user OAuth is preferable where the search platform can enforce document or index access directly. It adds consent, token lifecycle and gateway configuration work, but avoids concentrating broad read privileges in one agent credential. For relevance, we would evaluate keyword, vector and hybrid retrieval against representative questions rather than assume embeddings alone are sufficient.

How We Would Implement It

  • Define a document schema with stable IDs, source links, ownership and access metadata. Build an ingestion pipeline that records indexing failures and supports reindexing when content or embedding models change.
  • Benchmark candidate retrieval approaches on a labeled set of business questions. Measure whether the right permitted documents are retrieved, answer grounding, latency and cost before adding reranking or more agent steps.
  • Enforce access at retrieval time. For an AgentCore–Elasticsearch deployment, configure the OAuth MCP client, store its secret in AWS Secrets Manager, connect AgentCore Identity to Elastic’s OAuth endpoints, and test with users holding different Elastic roles. [1]
  • Return source references with retrieved passages, constrain answers to authorized evidence, and log retrieval decisions without exposing document contents or tokens in application logs.
  • Pin search-service image versions and rehearse upgrades in staging. For Vespa, test the available AlmaLinux 8 and 9 images against custom Java code and native dependencies before changing production tags. [2]

Risks, Costs and Security

Authorization tests must cover both direct search and agent tool calls. Elastic connection revocation is immediate in Elastic, but AgentCore Gateway may continue using a stored token for up to one hour; forcing reauthentication can shorten that window. Security procedures should account for that delay. [1]

Hybrid retrieval, reranking and larger indexes may improve results but add query latency, storage and compute cost. Relevance evaluations should justify each addition. For Vespa, existing AlmaLinux 8 tags will remain available after new AlmaLinux 8 images stop being published in 2027, but they will not receive subsequent Vespa fixes; remaining on them is a maintenance decision, not a long-term upgrade strategy. [2]

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] Who's asking? Per-user Elasticsearch access for Amazon Bedrock AgentCore agents
  2. [2] The Vespa Docker image is moving to AlmaLinux 9

Leave a comment

0.0/5

Engineering Founded & Customer Focused

KIMBODO LLC. © 2026. All Rights Reserved.