<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jon Handler</title>
    <description>The latest articles on DEV Community by Jon Handler (@jon_handler_9bb3e6b4a2fd0).</description>
    <link>https://dev.to/jon_handler_9bb3e6b4a2fd0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4046074%2F5ddf57fd-8f7b-453a-880e-b176878de577.jpg</url>
      <title>DEV Community: Jon Handler</title>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jon_handler_9bb3e6b4a2fd0"/>
    <language>en</language>
    <item>
      <title>Amazon OpenSearch Memory: Give Your Strands Agent Persistent Memory Without Building a Memory System</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Tue, 24 Nov 2026 19:08:13 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/amazon-opensearch-memory-give-your-strands-agent-persistent-memory-without-building-a-memory-system-4dfd</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/amazon-opensearch-memory-give-your-strands-agent-persistent-memory-without-building-a-memory-system-4dfd</guid>
      <description>&lt;p&gt;&lt;em&gt;Your agent already has a model, tools, and a prompt. The fourth piece shouldn't be a side project.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once an agent talks to the same people more than once, it needs memory, the same way a stateful application needs a database. Teams know this, and many of them end up building it: an embedding pipeline, an extraction prompt, a vector index, deduplication logic, retention jobs, and per-user isolation, all running next to the agent they actually wanted to ship. Amazon OpenSearch Memory, &lt;a href="https://aws.amazon.com/blogs/big-data/introducing-amazon-opensearch-memory-persistent-memory-for-ai-agents/" rel="noopener noreferrer"&gt;generally available as of November 18, 2026&lt;/a&gt;, turns that stack into a service built on Amazon OpenSearch Serverless. This post makes the case that memory belongs in every agent's architecture, explains how OpenSearch Memory works, and wires it into a Strands agent with two calls per turn.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory is part of the architecture
&lt;/h2&gt;

&lt;p&gt;Alongside a model to reason, tools to act, and a prompt to set its role, every agent needs a fourth component. Memory lets the agent improve across conversations. A support agent that recalls the open case and the customer's product configuration doesn't ask the customer to repeat themselves. A coding agent that recalls repository conventions and past decisions doesn't make the same mistake twice. An operations agent that recalls how last month's incident was resolved can propose the fix before anyone opens the runbook.&lt;/p&gt;

&lt;p&gt;On paper, passing the whole conversation history to the model every time looks like a shortcut. It gets slower and more expensive as history grows, and the one relevant detail gets harder for the model to find. The OpenSearch Service team &lt;a href="https://aws.amazon.com/blogs/big-data/introducing-amazon-opensearch-memory-persistent-memory-for-ai-agents/" rel="noopener noreferrer"&gt;measured the difference on LongMemEval-S&lt;/a&gt;, a public benchmark of 500 questions spread across about 50 chat sessions per user. With the full history in context, the answering model scored 95.2 percent at about 167,000 input tokens per question. With the top 30 results from OpenSearch Memory, it scored 93.0 percent at about 13,500 tokens, roughly one-twelfth the input. Retrieving raw conversation turns with BM25 alone scored 88.6 percent. Your results will differ from this one tested configuration, but extracted and consolidated memory kept most of the accuracy at a fraction of the token cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  What building it yourself involves
&lt;/h2&gt;

&lt;p&gt;Beyond the transcripts themselves, a working memory system has to extract facts and summaries from raw turns, embed them, and reconcile each new fact with what it already knows. Reconciliation means an updated address replaces the old one instead of sitting next to it. The system also has to retrieve the right few items for the current question, keep one user's memories from ever surfacing for another, and age data out on a schedule your compliance team can sign off on. Then someone has to run it, scale it, and check that the retrieved memories actually make the agent's answers better.&lt;/p&gt;

&lt;p&gt;Put together, those pieces add up to a search system with an extraction pipeline attached. For a team whose goal is a better agent, all of that is undifferentiated work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Amazon OpenSearch Memory works
&lt;/h2&gt;

&lt;p&gt;At the center of OpenSearch Memory is a space, an AWS resource that acts as the memory store for one application. Your application writes events into the space, and the service derives memories from them.&lt;/p&gt;

&lt;p&gt;On the write side, an event records what happened: one or more conversation turns, each with a role and text, or a structured JSON record such as the result of a deployment. OpenSearch Memory stores each event verbatim. It's readable as soon as the write returns and searchable with keyword, semantic, or hybrid queries within seconds. Verbatim storage gives an agent that restarts mid-conversation the exact turns it needs to pick up where it left off.&lt;/p&gt;

&lt;p&gt;On the learning side, a memory captures what the agent took away from those events. Memory strategies on the space extract memories in the background, using an Amazon Bedrock model that you choose. A &lt;code&gt;SEMANTIC&lt;/code&gt; strategy extracts lasting &lt;em&gt;facts&lt;/em&gt; and &lt;em&gt;preferences&lt;/em&gt;, a &lt;code&gt;SUMMARY&lt;/code&gt; strategy maintains a running summary of each session, and a &lt;code&gt;CUSTOM&lt;/code&gt; strategy extracts whatever your own prompt describes, such as every case ID and its status. A space can run up to 10 strategies over the same events. Extraction fires on the first of three triggers: a message count (12 by default), an optional token count, or a period of silence (60 seconds by default). With default settings, new memories are searchable within about a minute after a conversation goes quiet.&lt;/p&gt;

&lt;p&gt;Without consolidation, a memory store fills up with every version of every fact. When a strategy extracts a new memory, the service compares it with similar memories it already holds for that user and adds it, updates an existing memory with the newer information, or skips it as a duplicate. If a customer mentions switching from the starter plan to the business plan, the next search returns the business plan, not both. Every memory carries the IDs of the events it came from, so you can trace any fact back to the conversation that produced it.&lt;/p&gt;

&lt;p&gt;For scoping, every request carries two IDs. The actor is the end user the data belongs to, and the session groups the turns of one conversation. Every search covers exactly one actor, so one user's memories never surface in another user's results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wiring it into a Strands agent
&lt;/h2&gt;

&lt;p&gt;In a Strands agent, memory takes two calls per turn: search before the agent responds, and write after. The setup is a one-time &lt;code&gt;create_space&lt;/code&gt; call with the AWS SDK for Python (Boto3) 1.44.4 or later. &lt;a href="https://aws.amazon.com/blogs/big-data/introducing-amazon-opensearch-memory-persistent-memory-for-ai-agents/" rel="noopener noreferrer"&gt;The launch blog&lt;/a&gt; walks through it, along with the event and search calls this wrapper builds on. The space used here runs the &lt;code&gt;SEMANTIC&lt;/code&gt; and &lt;code&gt;SUMMARY&lt;/code&gt; strategies and keeps raw events for 90 days and memories for a year.&lt;/p&gt;

&lt;p&gt;Before each response, the recall step runs a hybrid query against the user's memories and returns them as plain text for the prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"hybrid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"queries"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"match"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"memory_text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"neural"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"memory_vector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"query_text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"k"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;osm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_memories&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spaceId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;SPACE_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actorId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                               &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxResults&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;hits&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"memories"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After each response, the remember step writes the exchange back to the space as one conversational event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;turns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"USER"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ASSISTANT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"conversational"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"unified"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;turns&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;osm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spaceId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;SPACE_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actorId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="n"&gt;sessionId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With those two functions in place, the Strands side stays short.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;strands&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;system_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"You are a support agent for a software company."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Known about this user:\n{context}\n\nUser: {question}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;answer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Around that wrapper, Strands still runs its own loop over the model and any tools you've given it. The &lt;code&gt;recall&lt;/code&gt; step adds what the agent knows about this user to the prompt, and the &lt;code&gt;remember&lt;/code&gt; step writes the exchange back as an event. Because the write returns as soon as the event is stored and extraction runs afterward, memory never adds extraction time to the agent's response.&lt;/p&gt;

&lt;p&gt;To let the agent decide what to save, wrap &lt;code&gt;CreateMemory&lt;/code&gt; in a Strands &lt;code&gt;@tool&lt;/code&gt;. The agent can then record its own findings, such as what a case is waiting on. Tag those memories with metadata like &lt;code&gt;writtenBy&lt;/code&gt;, because agent-written memories feed later prompts and deserve a review path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Searching memory like OpenSearch
&lt;/h2&gt;

&lt;p&gt;Because memory search uses a subset of the OpenSearch Query DSL, the queries look familiar. A hybrid query, as in the recall function above, is usually the right fit for agent recall. The keyword half finds exact strings like a case number or a product name, and the semantic half finds paraphrases, such as a question about "how they like to be contacted" matching a stored preference for email.&lt;/p&gt;

&lt;p&gt;Inside a &lt;code&gt;bool&lt;/code&gt; query, you can filter by metadata tags or creation time without changing the score. A decay function on a time field prefers recent memories without excluding older ones. Once a space holds facts, summaries, and custom records side by side, you can target searches at specific strategies. You can also search events directly to find an exact phrase, such as a commitment the agent made earlier in the conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Isolation, retention, and control
&lt;/h2&gt;

&lt;p&gt;For isolation, &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/memory-best-practices.html" rel="noopener noreferrer"&gt;the docs recommend&lt;/a&gt; one space per application, with users separated by actor ID and environments such as development and production in separate spaces. When end users call the service with their own credentials, the &lt;code&gt;osm:actorId&lt;/code&gt; IAM condition key limits each principal to that user's data. Data is encrypted with AWS Key Management Service, with an optional customer managed key. AWS CloudTrail records API activity, and Amazon CloudWatch reports metrics.&lt;/p&gt;

&lt;p&gt;On retention, each space sets its own limits. Events can stay from 1 to 365 days, and memories from 1 day to 10 years or indefinitely. OpenSearch Memory removes expired data for you. OpenSearch Memory is available in US East (N. Virginia), US West (Oregon), Asia Pacific (Tokyo), and Europe (Frankfurt).&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;Like the model and the tools, memory is a basic part of every agent. Building it yourself means running a search engine, an extraction pipeline, and a consolidation process, plus isolation and retention, alongside the agent. Amazon OpenSearch Memory, built on Amazon OpenSearch Serverless, takes all of that on as a service. For a Strands agent, the change is two calls per turn: search before responding, write after. Create a space, add those two calls, and your agent remembers the next time the same user comes back.&lt;/p&gt;

</description>
      <category>opensearch</category>
      <category>aiagents</category>
      <category>vectorsearch</category>
      <category>airetrieval</category>
    </item>
    <item>
      <title>Hand Off Your Vector Search POC: A README and RECREATE.md for Amazon OpenSearch Service</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Wed, 18 Nov 2026 18:38:51 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/hand-off-your-vector-search-poc-a-readme-and-recreatemd-for-amazon-opensearch-service-4o47</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/hand-off-your-vector-search-poc-a-readme-and-recreatemd-for-amazon-opensearch-service-4o47</guid>
      <description>&lt;p&gt;&lt;em&gt;The proof of concept worked in my account. The real test was whether the customer's team could build it again in theirs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A customer evaluating Amazon OpenSearch Service as a vector store asked for two things: proof that it could serve 300 queries per second against 4,096-dimension vectors with server-side latency under 50 milliseconds, and an easy path to load those vectors. I built a proof of concept in my own account that loaded 10 million synthetic 4,096-dimension vectors from Amazon S3 through Amazon OpenSearch Ingestion and benchmarked it. The numbers came in well under the target. Then I hit the harder problem, which every team that builds a POC eventually hits: the people who take it to production weren't in the room while I built it. This post covers what I built, what the load taught me, and how a coding agent turned the whole thing into two markdown files the customer could use to rebuild it on their side.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ask: throughput, latency, and a loading path
&lt;/h2&gt;

&lt;p&gt;Most vector search POCs start with a latency number. This customer needed 300 queries per second at k=500 with server-side latency under 50 milliseconds. Large k matters here, because every shard returns its own 500 candidates and the coordinator merges them. The cost of a query grows with the number of shards it touches, so the shard layout is part of the latency answer.&lt;/p&gt;

&lt;p&gt;The loading path mattered just as much. Their embeddings already lived in files, and they didn't want to write and run a custom bulk loader. I proposed S3 to OpenSearch Ingestion to OpenSearch Service. An ingestion pipeline scans the bucket once, parses each line into a document, and writes it to the domain over HTTPS with SigV4. Nobody has to operate loader hosts, and the pipeline scales its OpenSearch Compute Units (OCUs) on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;The whole stack is a single self-contained AWS CloudFormation template, synthesized from AWS CDK in Python. Anyone can deploy it directly without CDK, bootstrapping, or an asset bucket. It creates an OpenSearch Service domain on OpenSearch 3.7 with &lt;code&gt;r8gd.8xlarge.search&lt;/code&gt; data nodes, three dedicated cluster manager nodes, and zone awareness across three Availability Zones. The domain runs inside a VPC with fine-grained access control and encryption in transit and at rest.&lt;/p&gt;

&lt;p&gt;The vector index uses Faiss HNSW in on_disk mode at 8x compression. Four-bit quantized vectors and the graph live in memory, and full-precision vectors stay on local NVMe for rescoring if recall needs it. GPU acceleration builds the HNSW graphs for large segments, including the post-load force merge, on service-managed GPUs. The data nodes keep their CPU for indexing and search.&lt;/p&gt;

&lt;p&gt;The ingestion pipeline creates its own index template on start, so the index comes up with the right mapping on the first bulk write. Failed documents land in a dead-letter bucket. A small post-load script stops the pipeline, force merges to one segment per shard, adds the replica, waits for green health, and warms the graphs.&lt;/p&gt;

&lt;p&gt;The coding agent and I worked out the sizing from three rules. Shard size came first: each primary shard should hold 50 to 100 GB, because recovery and relocation slow down above that. At more than 100 million 4,096-dimension vectors, an index copy runs to a couple of terabytes, which allows anywhere from about 23 to 45 primaries. We picked the fewest that stayed comfortably under 100 GB, 30 primaries. At k=500, every primary returns 500 candidates per query, so each extra shard adds work to every search. Node count came next. A query touches one copy of every primary, so each data node handles query rate × primaries ÷ nodes shard searches per second. With 15 data nodes, that's 300 × 30 ÷ 15, or 600 shard searches per second per node. If each shard search takes about 10 ms, that keeps a 32-vCPU node at roughly 19 percent busy at peak, which leaves room for p99 spikes and for losing a node. The node count also had to be a multiple of three, one set per Availability Zone, and divide the 60 shard copies evenly. Memory and disk fit easily at that size, so CPU and latency set the node count, not capacity.&lt;/p&gt;

&lt;p&gt;For the benchmark I generated 10 million synthetic 4,096-dimension vectors and loaded them into three primary shards on six data nodes. That made each shard about the same size as a production shard. To put the same load on each node that production would, the benchmark has to scale the query rate by the shards-per-node ratio: 300 × (30 ÷ 15) ÷ (3 ÷ 6) works out to 1,200 queries per second. An open-loop load generator ramped from 50 up to 1,400 queries per second, past that mark. At k=500 with rescoring off, server-side latency held at a p50 of 9 ms and a p99 of 15 ms across the ramp, with zero errors. Production fans out to more shards, so I tell teams to expect production p50 to land near the benchmark's p90. Even then, the result clears the 50 ms target with room to spare.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the load taught me
&lt;/h2&gt;

&lt;p&gt;The first load hit several problems. Each one taught me something the customer's team would need. Load throughput peaked when the OpenSearch Ingestion pipeline reached about 26 OCUs, then fell as the pipeline kept scaling. Bulk latency climbed past 15 seconds, and the domain started rejecting writes. With zero replicas during the load, only the nodes holding primaries take writes, and their indexing memory filled up. The fix was to cap the pipeline at two to three OCUs per write node and cut the bulk size from 20 MiB to 5 MiB.&lt;/p&gt;

&lt;p&gt;Under that back-pressure, the pipeline also re-read about 40 percent of the S3 objects. Large files didn't finish before another OCU claimed them. Setting a document ID field turned those re-reads into harmless overwrites instead of duplicates. Keeping each source file in S3 under about 50 MB stopped most of the re-reads. That limit applies to the files the pipeline scans, separate from the 5 MiB size of each bulk request it sends to the domain. Heap pressure that stayed high after the load came down with a single refresh, which became the first step of the post-load script.&lt;/p&gt;

&lt;p&gt;None of this was visible in the design on paper. All of it would bite the customer's team on their first load if nobody wrote it down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why POC handoffs are hard
&lt;/h2&gt;

&lt;p&gt;The person who builds a POC knows why every setting is there. The team that takes it to production, often SREs or a platform group, sees the settings without the reasons. They also work against different constraints: their own VPC and subnets, their own IAM model, their own S3 bucket and encryption keys, and data that may not match the synthetic set. A template alone doesn't tell them which values they can change, which ones are fixed once the index exists, or what to check before they deploy.&lt;/p&gt;

&lt;p&gt;The usual handoff is a meeting, a slide deck, and a repository link. The reasons fade within a week. When something breaks during the production load, the team ends up rediscovering the same lessons I already paid for.&lt;/p&gt;

&lt;h2&gt;
  
  
  README and RECREATE: two files, two readers
&lt;/h2&gt;

&lt;p&gt;I had built the POC with a coding agent, so I asked that agent to write two markdown files from the work we had done together. Each file has a different reader.&lt;/p&gt;

&lt;p&gt;The README is for people. It explains the architecture, every CloudFormation parameter with its default and a sensible range, the sizing math behind the node and shard counts, the options I considered and rejected, and the lessons from the test load. It closes with a section titled "What we still don't know, and how to adjust." Each row there is an assumption, how to check it, what to change if it's wrong, and which file or parameter to edit.&lt;/p&gt;

&lt;p&gt;The RECREATE file is for a coding agent. It tells the agent what to build and in what order: the project layout, every parameter with its constraints, the verbatim assets, the validation to run after each change, and the done criteria. It also sets rules. The agent must collect every input before writing code, must not deploy or delete AWS resources without explicit human approval for that specific action, and must not put account IDs or credentials into files that will be shared.&lt;/p&gt;

&lt;p&gt;The most useful part of RECREATE is a set of fourteen decision points. Each one names when it applies, the question, how to determine the answer, the options with their consequences, and a default. Is the source data NDJSON or Parquet? Is there a unique ID field? Are metadata fields used for filtering? Can the subnets reach S3? Is the document count acceptable after the load? At each gate, the agent stops, reports what it found, and asks the human to choose. Those choices are recorded in a decisions file that later changes can cite. The unknowns that would have derailed a handoff become explicit questions with a way to answer them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handing the agent the keys, and the brakes
&lt;/h2&gt;

&lt;p&gt;This approach works because the reader on the other side is now often an agent too. The customer's engineer opens the repository with a coding agent, points it at RECREATE, and works through the decision points with their own account and data. The agent does the mechanical rebuilding, and the engineer makes the calls that depend on their environment. The README keeps the reasoning available for anyone who wants to know why.&lt;/p&gt;

&lt;p&gt;The same pattern fits any POC you plan to hand off. Build it with an agent, and while the context is still fresh, have the agent write down what it built for a human and how to rebuild it for another agent. Put the unknowns in a table with checks and defaults. Make the approval gates explicit, because the next team's account is not yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;The customer wanted proof that Amazon OpenSearch Service could serve 300 queries per second under 50 milliseconds, and an easy path to load their vectors. S3 to OpenSearch Ingestion to OpenSearch Service, with on_disk 8x compression and GPU-accelerated graph builds, delivered a 9 ms p50 on a production-sized shard layout. The benchmark answered the customer's question. The README and RECREATE files are what let their team build the same thing in their own account. If you build POCs for a living, try ending the next one by asking your agent to write both files.&lt;/p&gt;

</description>
      <category>opensearch</category>
      <category>vectorsearch</category>
      <category>airetrieval</category>
      <category>aws</category>
    </item>
    <item>
      <title>Time Series Collections in Amazon OpenSearch Serverless: Observability That Scales With the Incident</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Fri, 13 Nov 2026 19:35:34 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/time-series-collections-in-amazon-opensearch-serverless-observability-that-scales-with-the-incident-1i43</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/time-series-collections-in-amazon-opensearch-serverless-observability-that-scales-with-the-incident-1i43</guid>
      <description>&lt;p&gt;The worst hour of an incident is also the busiest hour for your telemetry. A collection that grows with that hour and drops back to zero afterward changes how you plan.&lt;/p&gt;

&lt;p&gt;Built for logs, metrics, traces, and events, the new time series collections in Amazon OpenSearch Serverless scale compute in seconds when telemetry surges and release it, all the way to zero, when the surge passes. Recent data stays hot, and older data moves to a cheaper warm tier that stays searchable. Alerting and anomaly detection run on the same collection that holds the data. With room for up to 100 TB of hot storage in a single collection, the ceiling is high enough for serious observability workloads. Where sizing for the peak is wasteful, flexible compute optimizes the cost: you pay for the capacity each hour uses, not the capacity the busiest hour needs. Agent traces arrive in bursts, which makes them a good test case, and the rest of this post uses them as the example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sized for the worst day
&lt;/h2&gt;

&lt;p&gt;During an incident, telemetry volume climbs at exactly the moment engineers need answers fastest. A bad deployment floods the logs with errors, retries multiply the traces, and every dashboard is open at once. When I size a logging domain with a customer, the conversation always comes back to that hour. Ingest cannot fall behind while people are waiting on it, so the domain gets sized for the peak, and the extra capacity sits idle the rest of the day. Storage pulls in the same direction. Keeping months of history hot gets expensive, so older data moves to snapshots, and someone has to restore one before anyone can query it.&lt;/p&gt;

&lt;p&gt;With agents in the mix, both pressures grow. As &lt;a href="https://medium.com/@jonhandler/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-f4254cda3a55" rel="noopener noreferrer"&gt;Implement Agent Observability&lt;/a&gt; and &lt;a href="https://medium.com/@jonhandler/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-cb80953701bc" rel="noopener noreferrer"&gt;From Log Lines to Agent Investigations&lt;/a&gt; describe, every model call and tool call an agent makes becomes a span in the same pipeline as your application traces. Evaluation jobs launch hundreds of runs at once. A single retry loop turns one request into dozens of spans. Development agents go quiet when their developers go home. Telemetry that used to spike only during incidents now spikes on schedules nobody sets for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compute that follows the spans
&lt;/h2&gt;

&lt;p&gt;For compute, each time series collection draws on its collection group, a shared pool of OpenSearch Compute Units (OCUs) with a floor and a ceiling that you set. With the floor at zero, the group releases all of its compute when nothing is arriving. The ceiling caps what any surge can cost. Express Create in the console sets up the group, encryption, and network access in one step, and the &lt;a href="https://aws.amazon.com/blogs/big-data/introducing-the-next-generation-of-serverless-time-series-for-amazon-opensearch-service/" rel="noopener noreferrer"&gt;launch post&lt;/a&gt; walks through the same setup from the AWS CLI.&lt;/p&gt;

&lt;p&gt;Because the collections in a group share its capacity, the group also works as a cost boundary. Giving development and production their own groups gives each its own ceiling, so an evaluation run in development cannot eat into the capacity production depends on. If scale-to-zero on Serverless is new to you, &lt;a href="https://medium.com/@jonhandler/what-if-your-search-infrastructure-only-existed-when-someone-searched-62057802c54d" rel="noopener noreferrer"&gt;What If Your Search Infrastructure Only Existed When Someone Searched?&lt;/a&gt; covers how it works for search collections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hot for a week, searchable for years
&lt;/h2&gt;

&lt;p&gt;When something goes wrong with an agent, the questions usually concern the last few hours, such as why a run failed this morning or what last night's batch cost. A time series collection keeps that window fast. At ingest, every document goes to both the hot tier and Amazon S3. Once it passes the age you choose, its hot copy is released and it lives on in the warm tier. A query that reaches older data pulls that range back into the hot tier. The first query over it is slower, and repeat queries run at hot-tier speed. Hot storage rates apply only to data that is still hot.&lt;/p&gt;

&lt;p&gt;Unlike a lifecycle policy, retention lives on the index itself, as the &lt;code&gt;index.data.retention&lt;/code&gt; setting, and it is independent of tiering. You can &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-data-retention.html" rel="noopener noreferrer"&gt;set it&lt;/a&gt; when an index is created, inherit it from an index template, or change it later on an index that already holds data. Shortening it applies to data already indexed, so anything older than the new limit is deleted permanently. Spans can stay hot for a week and be kept for 90 days, which covers both debugging and a quarterly cost review. When an audit asks what an agent did two months ago, the answer is a query against the same collection rather than a snapshot restore. On a managed domain, the observability maturity model in &lt;a href="https://medium.com/@jonhandler/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-cb80953701bc" rel="noopener noreferrer"&gt;From Log Lines to Agent Investigations&lt;/a&gt; reaches the same goal with UltraWarm. Here it takes two settings on an index template.&lt;/p&gt;

&lt;p&gt;Behind that tiering sits one requirement. Every document needs a designated &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-timestamp-field.html" rel="noopener noreferrer"&gt;timestamp field&lt;/a&gt;, and the service rejects any document without a valid one. The default field is &lt;code&gt;@timestamp&lt;/code&gt;, while OpenTelemetry span documents record their time in &lt;code&gt;startTime&lt;/code&gt;. Because the ingestion pipeline creates the span index on its own, the setting belongs in an index template that exists before the first span arrives. One template can carry it along with the tiering and retention settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="n"&gt;PUT&lt;/span&gt; &lt;span class="n"&gt;_index_template&lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="n"&gt;spans&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"index_patterns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"otel-v1-apm-span"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"template"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"index.timestamp_field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"startTime"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"index.warm.after"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"7d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"index.data.retention"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"90"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From then on, the span index uses &lt;code&gt;startTime&lt;/code&gt; as its time field, keeps spans hot for seven days, and deletes them after 90. Rejections apply to single documents rather than whole requests, so one bad record never fails a batch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alerts where the data lives
&lt;/h2&gt;

&lt;p&gt;With this launch, alerting and anomaly detection come to Serverless, running inside the collection that stores your telemetry. They are managed from OpenSearch UI workspaces, alongside the Agent Traces page and the PPL queries from earlier posts.&lt;/p&gt;

&lt;p&gt;Alerting in OpenSearch is built from four pieces that work together. At its center is a monitor, a job that runs a query against your data on a schedule. Each monitor carries one or more triggers, which are conditions checked against the query's results. When a trigger's condition holds, it creates an alert that you can acknowledge or mute in OpenSearch UI. A trigger can also run actions, which send a notification through a channel you configure. &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-configure-alerting.html" rel="noopener noreferrer"&gt;On Serverless&lt;/a&gt;, three kinds of monitor are available. Per-query monitors evaluate one aggregated result, per-bucket monitors evaluate each group separately, and PPL monitors express both the query and its conditions in PPL.&lt;/p&gt;

&lt;p&gt;Turning the loop check from &lt;a href="https://medium.com/@jonhandler/what-did-that-agent-run-cost-token-and-latency-accounting-in-opensearch-ui-e2af8b154fa4" rel="noopener noreferrer"&gt;What Did That Agent Run Cost?&lt;/a&gt; into a PPL monitor takes its query and adds a schedule and a trigger. The monitor below runs every five minutes, counts tool calls per run, and fires when any run calls one tool more than five times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Agent tool-call loops"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"monitor_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ppl_monitor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"schedule"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"period"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"unit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"MINUTES"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"interval"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"inputs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"ppl_input"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"source = otel-v1-apm-span | where `attributes.gen_ai.operation.name` = 'execute_tool' | stats count() as tool_calls by traceId, `attributes.gen_ai.tool.name`"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"query_language"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ppl"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"triggers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"ppl_trigger"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Tool called more than 5 times in one run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"severity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"custom"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"custom_condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"where tool_calls &amp;gt; 5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"actions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Notify on-call"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"destination_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;channel-id&amp;gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Serverless, a monitor has to name a concrete index, as the &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-configure-alerting.html" rel="noopener noreferrer"&gt;Serverless alerting documentation&lt;/a&gt; notes, and a wildcard such as &lt;code&gt;otel-v1-apm-span*&lt;/code&gt; is rejected. On a time series collection, that restriction costs nothing. The collection keeps one index per name instead of rolling over to new ones, and retention ages old spans out inside that same index. The name the pipeline writes to, &lt;code&gt;otel-v1-apm-span&lt;/code&gt;, therefore always holds current data. Monitors belong to an OpenSearch UI workspace, so you create them there, or through the workspace's API, rather than on the collection. With the same pieces, a per-bucket monitor on input tokens, bucketed by agent name, catches the one agent that crosses its budget even when the rest of the fleet is quiet.&lt;/p&gt;

&lt;p&gt;Rather than relying on a fixed threshold, anomaly detection learns what normal looks like. Its detectors use the Random Cut Forest algorithm to model the usual rhythm of a metric and flag deviations in near real time. Pointed at token usage, a detector can learn the daily pattern of spend and flag a sudden jump, whatever caused it. A prompt change, a new tool, and a retry loop all look the same to the detector: spend that does not match the pattern. On Serverless, the detector writes its findings to a result index in the same collection. A per-query or per-bucket monitor on that index, with a trigger on anomaly grade and confidence, turns each finding into a notification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;Observability data surges when things break, gets read mostly while it is fresh, and needs watching around the clock. Time series collections in Amazon OpenSearch Serverless fit each part of that pattern. Compute rises with the surge and falls back to zero when it passes. Two index settings handle tiering and retention without a lifecycle policy. Alerting and anomaly detection run where the data already lives, with up to 100 TB hot in one collection. Agent traces show the fit clearly, and the same collection holds the application logs and metrics they sit beside. The &lt;a href="https://aws.amazon.com/blogs/big-data/introducing-the-next-generation-of-serverless-time-series-for-amazon-opensearch-service/" rel="noopener noreferrer"&gt;launch post&lt;/a&gt; has the full setup.&lt;/p&gt;

</description>
      <category>observability</category>
      <category>opensearch</category>
      <category>serverless</category>
      <category>aiagents</category>
    </item>
    <item>
      <title>What Did That Agent Run Cost? Token and Latency Accounting in OpenSearch UI</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Tue, 10 Nov 2026 17:48:39 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/what-did-that-agent-run-cost-token-and-latency-accounting-in-opensearch-ui-1387</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/what-did-that-agent-run-cost-token-and-latency-accounting-in-opensearch-ui-1387</guid>
      <description>&lt;p&gt;Every model call your agent makes is already a span with a token count. A few PPL queries turn those spans into a bill.&lt;/p&gt;

&lt;p&gt;For most teams, the cost of last Tuesday's agent runs shows up weeks later on the model provider's invoice, as one number for the whole account. That number can't tell you which agent spent the money, which service called it, or which run got stuck in a loop. When you instrument an agent with OpenTelemetry, each step it takes becomes a span: one for the run as a whole, and one for every model call and tool call inside it. Each model-call span records which model answered, how many input and output tokens it used, and how long it took. Those spans travel the same path as the rest of your application traces, through an OpenTelemetry Collector and Amazon OpenSearch Ingestion into an Amazon OpenSearch Service domain. Once they land there, OpenSearch UI can query them. This post walks through the PPL queries that turn those spans into cost and latency per model, per run, and per service, and that find the loops that spend tokens without producing answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the numbers come from
&lt;/h2&gt;

&lt;p&gt;In the &lt;a href="https://medium.com/@jonhandler/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-cb80953701bc" rel="noopener noreferrer"&gt;observability maturity model&lt;/a&gt; from the previous post, agents observed as a workload make up the third rung, and this post zooms in on it. Instrumented with the OpenTelemetry GenAI semantic conventions, an agent emits one trace per run. A root span marks the agent invocation, and child spans mark each model call, tool call, and retrieval. The attribute &lt;code&gt;gen_ai.operation.name&lt;/code&gt; says which is which: &lt;code&gt;invoke_agent&lt;/code&gt; for the agent, &lt;code&gt;chat&lt;/code&gt; for a model call, and &lt;code&gt;execute_tool&lt;/code&gt; for a tool. Model-call spans also carry &lt;code&gt;gen_ai.request.model&lt;/code&gt; and the token counts in &lt;code&gt;gen_ai.usage.input_tokens&lt;/code&gt; and &lt;code&gt;gen_ai.usage.output_tokens&lt;/code&gt;. Every span also records its own &lt;code&gt;durationInNanos&lt;/code&gt;. Auto-instrumentation for Amazon Bedrock, OpenAI, Anthropic, LangChain, and &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/observability-ai.html" rel="noopener noreferrer"&gt;more than 20 other libraries&lt;/a&gt; sets these attributes for you. An OpenTelemetry Collector then sends the spans through Amazon OpenSearch Ingestion into the &lt;code&gt;otel-v1-apm-span*&lt;/code&gt; indexes, as &lt;a href="https://medium.com/@jonhandler/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-f4254cda3a55" rel="noopener noreferrer"&gt;Implement Agent Observability&lt;/a&gt; describes. For a step-by-step setup, the &lt;a href="https://observability.opensearch.org/docs/ai-observability/getting-started/" rel="noopener noreferrer"&gt;OpenSearch Observability Stack getting-started guide&lt;/a&gt; walks through instrumenting an agent with the Python SDK and viewing its traces.&lt;/p&gt;

&lt;p&gt;OpenSearch UI already does some of the arithmetic. In an observability workspace, Discover includes an Agent Traces page. A metrics bar across the top shows trace count, average duration, error rate, and token usage for the time range and query you select. Below it, the Traces tab lists the input and output tokens for every run. That view answers how much in total. Who spent it, and why, takes a query. The &lt;a href="https://docs.opensearch.org/latest/observing-your-data/agent-traces/agent-tracing/" rel="noopener noreferrer"&gt;Agent Traces page&lt;/a&gt; fetches all of its data with PPL, so the same query panel accepts your own. Totals by model come first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source = otel-v1-apm-span*
| where isnotnull(`attributes.gen_ai.request.model`)
| stats avg(durationInNanos) as avg_ns,
        sum(`attributes.gen_ai.usage.input_tokens`) as input_tokens,
        sum(`attributes.gen_ai.usage.output_tokens`) as output_tokens
    by `attributes.gen_ai.request.model`
| eval avg_ms = avg_ns / 1000000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Durations are stored in nanoseconds, so the last line converts the average to milliseconds. To turn tokens into dollars, add one more step. Providers price input and output tokens separately, usually per million tokens, and the rates differ by model, so the calculation runs one model at a time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source=otel-v1-apm-span*
| where `attributes.gen_ai.request.model` = 'claude-sonnet-4.5'
| stats sum(`attributes.gen_ai.usage.input_tokens`) as input_tokens, sum(`attributes.gen_ai.usage.output_tokens`) as output_tokens
| eval est_cost_usd = input_tokens / 1000000.0 * 3.00 + output_tokens / 1000000.0 * 15.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swap in the model you run and the rates you actually pay, whether that is your provider's current price list or a negotiated rate. Treat the result as an estimate, since it leaves out discounts, cached-token pricing, and anything billed outside tokens. Its value is timing: it arrives while the run is still fresh rather than at month end.&lt;/p&gt;

&lt;p&gt;Before trusting any of these sums, check where your instrumentation records tokens. Some libraries roll a run's totals up onto the root agent span as well as recording them on each model call, and summing across every span then counts the same tokens twice. Adding &lt;code&gt;where `attributes.gen_ai.operation.name` = 'chat'&lt;/code&gt; to a query keeps the sums on model calls only. My test data is shaped this way, so the queries in this post filter on &lt;code&gt;chat&lt;/code&gt; spans. Other instrumentation records a run's tokens only on the &lt;code&gt;invoke_agent&lt;/code&gt; span, and in that case you need to filter on that span instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which run, and whose
&lt;/h2&gt;

&lt;p&gt;Per-model totals show which model costs the most. Per-run totals show which requests do, and grouping by trace ID ranks the runs themselves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source = otel-v1-apm-span*
| where `attributes.gen_ai.operation.name` = 'chat'
| stats sum(`attributes.gen_ai.usage.input_tokens`) as input_tokens,
        sum(`attributes.gen_ai.usage.output_tokens`) as output_tokens,
        count() as model_calls
    by traceId
| sort - input_tokens
| head 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the query aggregates, the Agent Traces page shows the result on its Visualization tab as a chart rather than a list. To read one run in detail, note its trace ID and switch to the Traces tab next to Visualization, which lists every agent run with its duration, span count, and input and output tokens. Selecting that run's row opens the trace details, where the trace tree lists the tokens beside every operation and the timeline shows where the time went. Where &lt;code&gt;du -sh&lt;/code&gt; on a full disk points you at the directory to clean up, this query points you at the run to open. A run that made 40 model calls when most make 4 has usually been retrying a failing tool and resending its whole context to the model on every attempt.&lt;/p&gt;

&lt;p&gt;With the same pattern, you can charge spend back to whoever owns it. Every span carries the name of the service that emitted it, so grouping by &lt;code&gt;serviceName&lt;/code&gt; instead of &lt;code&gt;traceId&lt;/code&gt; gives tokens per service. For showback by team or cost center, add a resource attribute such as a team name in your OpenTelemetry SDK or Collector configuration. You set it once. From then on it rides along on every span the service emits and becomes one more field to group by.&lt;/p&gt;

&lt;h2&gt;
  
  
  Loops that spend quietly
&lt;/h2&gt;

&lt;p&gt;More often than not, an expensive run is a broken one. An agent can call the same tool over and over, getting an error or an unhelpful result each time and resending its whole context to the model between attempts. It can still return a plausible answer with a normal status code, so nothing in the response looks wrong. The trace shows the repetition plainly, and one query finds it across every run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source = otel-v1-apm-span*
| where `attributes.gen_ai.operation.name` = 'execute_tool'
| stats count() as tool_calls by traceId, `attributes.gen_ai.tool.name`
| where tool_calls &amp;gt; 5
| sort - tool_calls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The threshold of 5 is arbitrary, so set it from what normal runs look like in your own data, and check it on a schedule so a loop surfaces while it is still running. The same tool spans also show which tools are slow. Grouping &lt;code&gt;durationInNanos&lt;/code&gt; by &lt;code&gt;gen_ai.tool.name&lt;/code&gt; with &lt;code&gt;avg&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; separates a tool that is slow every time from one that only occasionally hangs, and the second kind is often what sends an agent into its retries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;An agent's cost and latency do not have to be reconstructed from an invoice. They are attributes on spans the agent already emits, stored in Amazon OpenSearch Service with the rest of your telemetry. The Agent Traces page in OpenSearch UI shows the totals. A handful of PPL queries break them down by model, by run, by service, and by tool, put a dollar estimate on them, and find the loops that spend without answering. That turns the third rung of the &lt;a href="https://medium.com/@jonhandler/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-cb80953701bc" rel="noopener noreferrer"&gt;maturity model&lt;/a&gt; into numbers you can act on, and the same queries can set a token and cost budget for the investigators at the top of the ladder.&lt;/p&gt;

</description>
      <category>observability</category>
      <category>opentelemetry</category>
      <category>aiagents</category>
      <category>opensearch</category>
    </item>
    <item>
      <title>From Log Lines to Agent Investigations: An Observability Maturity Model for Amazon OpenSearch Service</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Wed, 04 Nov 2026 20:38:51 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-59mf</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/from-log-lines-to-agent-investigations-an-observability-maturity-model-for-amazon-opensearch-59mf</guid>
      <description>&lt;p&gt;Every on-call team climbs the same ladder. The agent at the top is only as good as the rungs underneath it.&lt;/p&gt;

&lt;p&gt;At 2:07 a.m. the page says checkout is failing, and the investigation starts wherever the telemetry happens to live: a log search in one tool, a latency chart in another, no traces, and anything older than a few weeks in an archive nobody can query. Agents are about to take on much of that investigating. Gartner expects half of organizations to run IT operations with AI agents and minimal human involvement by 2030, up from almost none today (&lt;a href="https://www.gartner.com/en/newsroom/press-releases/2026-10-26-gartner-identifies-the-top-ai-trends-in-infrastructure-and-it-operations-for-2027" rel="noopener noreferrer"&gt;Gartner&lt;/a&gt;). Dropped into a scattered stack, an agent inherits the scatter. Getting from log lines to agent investigations takes five rungs, each resting on the one below, and Amazon OpenSearch Service with its observability stack covers all five on one set of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The climb starts with log lines
&lt;/h2&gt;

&lt;p&gt;On almost every logging domain I look at, the first rung is the same: log search on tiered storage. Applications write logs, a shipper such as Fluent Bit sends them to an Amazon OpenSearch Service domain, and engineers read them in dashboards. Hot storage on the data nodes is the fast, expensive part, so the last few days live there and older indexes move to the &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ultrawarm.html" rel="noopener noreferrer"&gt;UltraWarm&lt;/a&gt; tier. UltraWarm keeps those indexes in Amazon S3 with caching in front, charges only for the data you store, and answers queries through the same APIs, though warm indexes are read-only and broad searches across many of them run slower. Data past the warm window often leaves the domain for an S3 archive that nobody queries during an incident. When the page comes, the questions arrive in a predictable order: which service is erroring, which request failed, which customer it hit. Logs answer the first question well. The second and third are harder, because nothing ties a log line to the request that produced it, and the metrics that showed the spike live in a different tool that names the same service differently.&lt;/p&gt;

&lt;p&gt;With agents everywhere in the news, the tempting move from here is straight to an agent. The step that really changes the investigation is quieter, and it is correlation. On the second rung, OpenTelemetry gives every signal the same identifiers and the same attribute names. A trace ID ties a log line, a span, and a metric exemplar to one request, and the &lt;a href="https://opentelemetry.io/docs/specs/semconv/" rel="noopener noreferrer"&gt;semantic conventions&lt;/a&gt; mean that &lt;code&gt;service.name&lt;/code&gt; refers to the same service everywhere it appears. Instrumenting once with the OpenTelemetry SDKs or auto-instrumentation, then pointing a stock OpenTelemetry Collector at an Amazon OpenSearch Ingestion endpoint, gives one pipeline that routes by signal. Logs and traces land in OpenSearch Service, metrics go to Amazon Managed Service for Prometheus, and the service map is built from the traces in flight.&lt;/p&gt;

&lt;p&gt;Once that pipeline exists, an investigation in OpenSearch UI follows a path instead of a hunch. From the alert, the rate, error, and duration view shows which service is failing, the service map shows the red edge from checkout to payment, the trace waterfall opens the failing span, and its logs come up with the trace context already applied. One PPL query gives the overview across every service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source = otel-v1-apm-span-*
| where status.code = 2
| stats count() by serviceName
| sort - count()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without that correlation, an agent reasoning over logs and metrics that share no identifiers has to guess which events belong together. Its answer sounds just as confident when the guess is wrong. Correlated, consistently structured telemetry is the precondition for every rung above this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents join the pipeline
&lt;/h2&gt;

&lt;p&gt;With correlated signals in place, agents join the pipeline in two roles, and each role is a rung. On the third rung, the agent is a workload: one more OpenTelemetry producer. Each model call and tool call is a span carrying &lt;code&gt;gen_ai.*&lt;/code&gt; attributes for the model, the operation, and the token counts, so its traces sit beside the services it calls, as &lt;a href="https://medium.com/@jonhandler/read-your-ai-agents-mind-opensearch-observability-for-llm-traces-918a54e1d456" rel="noopener noreferrer"&gt;Read Your AI Agent's Mind&lt;/a&gt; and &lt;a href="https://medium.com/@jonhandler/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-f4254cda3a55" rel="noopener noreferrer"&gt;Implement Agent Observability&lt;/a&gt; describe. On the fourth rung, the agent becomes the investigator and the first reader of the operational data. It reaches OpenSearch Service through MCP and runs the same queries an engineer would, and Amazon OpenSearch Service MCP Apps return the trace waterfall and service map in the chat thread so a person can check its work, the subject of &lt;a href="https://medium.com/@jonhandler/stop-switching-tabs-uplevel-the-sre-chat-window-with-amazon-opensearch-service-mcp-apps-d752edec42ff" rel="noopener noreferrer"&gt;Stop Switching Tabs&lt;/a&gt;. OpenSearch UI also includes a built-in Investigation Agent that plans its queries, reflects on what comes back, and returns ranked root-cause hypotheses with its reasoning visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Investigate the investigator
&lt;/h2&gt;

&lt;p&gt;Between investigating and acting, trust drops off. In a Grafana Labs survey with ETR, 85% of IT leaders said they were comfortable with AI running read-only investigations, while only 52% were comfortable with AI fixing incidents on its own (&lt;a href="https://grafana.com/press/2026/10/19/survey-ai-adoption-is-outpacing-trust-as-enterprises-push-toward-autonomous-operations/" rel="noopener noreferrer"&gt;Grafana Labs, 2026&lt;/a&gt;). Closing that gap takes evidence about the agent itself.&lt;/p&gt;

&lt;p&gt;On the fifth rung, at the top of the ladder, the investigator is also something to investigate. Every query it runs and every model call it makes emits spans into the same pipeline, so its work appears in OpenSearch UI like any other service. Where &lt;code&gt;strace&lt;/code&gt; shows each system call a process made, the investigator's own trace shows each query it ran, what came back, how many tokens it spent, and how long each step took. When an agent proposes a root cause, the evidence it actually retrieved sits beside the evidence it describes.&lt;/p&gt;

&lt;p&gt;Before an agent changes anything in production, four controls need to be in place. Every AI query should be audited, so there is a record of what the agent asked and what it saw. Identity has to travel end to end, so the agent's access through MCP is scoped by IAM and enforced by fine-grained access control rather than granted broadly. Sensitive fields should be masked before an agent or an engineer reads them. And each investigation needs a budget for tokens, cost, and runtime, because an agent stuck in a retry loop burns money quietly. With those controls in place, an agent can investigate freely while a person approves the action, which is the right place to draw the line today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;Five rungs carry an on-call practice from log lines to agent investigations: log search on tiered storage, correlated signals in one pipeline, agents observed as a workload, agents working as investigators, and investigators that can be audited. Correlation, on the second rung, decides whether an agent's confident answer is also a correct one, which makes it the rung not to skip. Amazon OpenSearch Service holds the whole climb on one set of data, from OpenTelemetry ingestion through OpenSearch UI to MCP, so each rung builds on the last instead of adding another tool. A future post zooms in on one rung and shows how to compute what agents cost, call by call, from the traces they already emit.&lt;/p&gt;

</description>
      <category>observability</category>
      <category>opentelemetry</category>
      <category>aiagents</category>
      <category>opensearch</category>
    </item>
    <item>
      <title>A Nightmare on Hollow Lane. Dedicated Cluster Managers Save the Day</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Thu, 29 Oct 2026 14:03:05 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/a-nightmare-on-hollow-lane-dedicated-cluster-managers-save-the-day-2ho6</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/a-nightmare-on-hollow-lane-dedicated-cluster-managers-save-the-day-2ho6</guid>
      <description>&lt;p&gt;Three houses, a lane full of trick-or-treaters, and a Halloween night with no one in charge.&lt;/p&gt;

&lt;p&gt;An Amazon OpenSearch Service domain does two kinds of work. It answers the requests your applications send, and it runs itself: choosing a leader, deciding which node holds which shard, and publishing every change to the cluster state. When a busy domain slows down, the usual fix is more or bigger data nodes, but the slowdown often comes from the second kind of work landing on the same nodes as the first. I first wrote a version of this story for my colleagues, and Halloween is the right night to bring it back, because it makes the answer easy to see: three small dedicated cluster manager nodes that give the domain its own command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Halloween night on Hollow Lane
&lt;/h2&gt;

&lt;p&gt;Every Halloween, the village of Hollowmere pools all of its candy into one shared stash and hands it out from three houses on Hollow Lane. The stash is far too big for one porch, so it sits in bowls spread across Kael's house, Mira's house, and Dorn's house. Every bowl has a twin on a different porch, so a knocked-over bowl never means lost candy. Any host can answer any knock. When a visitor wants something from a bowl on another porch, the host at the door shouts down the lane, the other hosts check their bowls, and the host hands over the whole haul.&lt;/p&gt;

&lt;p&gt;The visitors were the real challenge of the night, and their costumes told you what each one wanted. Ghosts drifted up with sacks of candy to add to the stash, and every piece had to land in the right bowl and in that bowl's twin. Pirates came hunting treasure: one particular kind of candy, wherever on the lane it happened to sit. Vampires, who in the old stories can never resist counting, wanted only tallies, such as how many chocolate bars were left, broken down by brand. They arrived by the hundreds, and the rule of the night was old and strict. Answer fast with a treat, or get a trick.&lt;/p&gt;

&lt;p&gt;The hosts had the candy, the bowls, and plenty of energy. What the lane did not have was anyone in charge of the night.&lt;/p&gt;

&lt;p&gt;For the first hour the hosts kept pace. Then the village council came out with lanterns and orders, and with no one else to take them, the council went straight to the hosts. Some orders changed how the night worked. “Start a new bowl just for gummy bats!” called the mayor. “Every candy needs a label saying whether it has nuts!” said the baker. “Two pieces per pirate from now on!” cried the schoolteacher. Each order meant all three hosts had to stop, take it in, and change how they worked, in the middle of answering the door.&lt;/p&gt;

&lt;p&gt;Other orders were bigger, and they cost more. “Who is in charge out here?” demanded the blacksmith, so the hosts had to stop and vote on a captain. “Which house keeps the caramel apples?” asked the miller, and they had to agree, then shuffle bowls when the next councilor disagreed. Then Dorn's porch light flickered out, and the other two had to work out which twin bowls now counted as the real ones and where to set out fresh twins, while the doorbells kept ringing.&lt;/p&gt;

&lt;p&gt;The visitors did not wait. Ghosts stood on the steps holding sacks no one had time to sort. A pirate waited while Kael shouted down the lane about bowl assignments instead of caramel apples. A vampire waiting on his tally gave up and started counting the gravel. Every visitor who waited too long played a trick, and by midnight Hollow Lane was draped in toilet paper. The hosts had not failed at handing out candy. The night had failed because no one was running it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Translating Hollow Lane
&lt;/h2&gt;

&lt;p&gt;In Amazon OpenSearch Service, Hollow Lane is your domain and the three houses are its data nodes. The candy is your data, the bowls are shards, and the twin bowls are replicas, placed on different nodes so that losing one node never loses data. The visitors are the requests your applications send: ghosts are indexing requests that add documents, pirates are search queries, and vampires are aggregations. Any data node can take a request and act as its coordinator, sending it to whichever nodes hold the relevant shards and gathering their answers into one response. A treat is a fast response. A trick is a slow or failed one.&lt;/p&gt;

&lt;p&gt;The council's orders are the domain's management work. The tactical orders are changes to the cluster state: a new bowl for gummy bats is creating an index, the nut labels are a mapping update, and two pieces per pirate is a settings change. Each change produces a new version of the cluster state that every node has to receive and apply. The strategic orders are cluster management itself: electing the cluster manager, deciding which node holds which shard, noticing when a node goes dark, promoting replicas to take its place, and computing every new version of the cluster state. Those are jobs for the domain as a whole, not for any one node. Without dedicated managers, the data nodes are the only candidates, so they do this work between requests.&lt;/p&gt;

&lt;p&gt;On a quiet lane that overhead barely registers. The trouble grows with the domain. As shard counts climb, mappings get larger, and indexes come and go more often, the council's orders multiply, and data nodes spend more time on management and less on requests. Latency rises, indexing throughput drops, and the tricks pile up. Under heavy load it can turn into a loop: data nodes get too busy to apply cluster state updates promptly, the elected manager retries, the retries add load, and the added load slows the data nodes further.&lt;/p&gt;

&lt;h2&gt;
  
  
  The witches in the bell tower
&lt;/h2&gt;

&lt;p&gt;The next Halloween, Hollow Lane had someone in charge. Three witches climbed the bell tower at the end of the lane. They handed out no candy and answered no doors. From the tower they could see every porch, and they kept the master list of which bowl sat where. Every councilor with an order now climbed the tower stairs instead of knocking on a host's door.&lt;/p&gt;

&lt;p&gt;Among themselves, the witches ran the night. One led, and the other two stood ready to take over if she fell. They decided which porch kept which bowl and moved bowls only when the lane changed. They watched every porch light, and when one went out they decided which twins took over and where the new twins went. They turned the council's requests into one clear instruction at a time and called it down the lane along with a fresh copy of the master list. The hosts heard each call, adjusted, and went back to the door, and because every house had the latest list, a host always knew which porch to shout to when a pirate asked for caramel apples. Nobody on the lane stopped to vote, and the toilet paper stayed at the store.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dedicated cluster managers in practice
&lt;/h2&gt;

&lt;p&gt;Dedicated cluster manager nodes are the witches: the command role for the whole domain, held by nodes that do nothing else. They hold no data, serve no queries, and index no documents. Their job is coordination: tracking every node, index, and shard, maintaining routing information, computing a new cluster state when indexes or nodes come and go, publishing that state to every node, and sending heartbeats to confirm the data nodes are healthy. The published cluster state is the master list. Every data node gets a copy, which is how a coordinating node knows where to send each request. Data nodes still apply each update, the way the hosts adjusted to each call from the tower, but they no longer compute it or vote on who leads. You will find the setting under its older name in the console, where these are still called &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-dedicatedmasternodes.html" rel="noopener noreferrer"&gt;dedicated master nodes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For production domains, AWS recommends three dedicated managers, and the reason is quorum. Only one manager is active at a time, while the other two wait as standbys. If the active one fails, the remaining two still form a majority and elect a replacement without pulling in the data nodes. Two managers cannot do that, because losing one leaves no majority, and without quorum the domain fails both reads and writes. Four buys nothing over three and can lose quorum when an Availability Zone goes down, which is why AWS never recommends an even number. When you deploy with Multi-AZ with Standby, the service provisions the three managers across three zones for you.&lt;/p&gt;

&lt;p&gt;Because managers coordinate rather than store, you size them by how much they have to track, not by how much data you hold. The AWS guidance scales manager memory with the number of nodes and shards in the domain. On OpenSearch 2.17 and later, an 8 GB manager handles up to 30 nodes and 15,000 shards, and a 32 GB manager handles up to 120 nodes and 60,000 shards. Domains with many shards or large field mappings may need the next size up. Either way, the managers cost a small fraction of the data tier, which is a modest price for the stability they buy back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;An Amazon OpenSearch Service domain has two kinds of work: answering the requests your applications send, and running the domain itself. Without dedicated cluster managers, nobody is assigned the second job, so the data nodes answer the door, carry out every change to the cluster state, and argue out who leads and where each shard lives, all at once. Dedicated cluster manager nodes give the domain its command. They take the management work away from the data nodes and turn every change into a published update the data nodes only have to apply. Three of them give you quorum, so a failed manager is replaced without the data nodes stopping to vote, and they run on instances sized to the domain's node and shard count rather than its data volume. If you run anything close to a production workload, put your witches in the tower before the first knock.&lt;/p&gt;

</description>
      <category>opensearch</category>
      <category>aws</category>
      <category>distributedsystems</category>
      <category>halloween</category>
    </item>
    <item>
      <title>Stop Switching Tabs: Uplevel The SRE Chat Window with Amazon OpenSearch Service MCP Apps</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Tue, 27 Oct 2026 16:58:17 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/stop-switching-tabs-uplevel-the-sre-chat-window-with-amazon-opensearch-service-mcp-apps-1ml9</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/stop-switching-tabs-uplevel-the-sre-chat-window-with-amazon-opensearch-service-mcp-apps-1ml9</guid>
      <description>&lt;p&gt;Your investigation agent finds the root cause in seconds. Then you open four browser tabs to check whether it is right. MCP Apps bring the evidence into the chat.&lt;/p&gt;

&lt;p&gt;Your investigation agent can hand you a root-cause hypothesis about as fast as you can read the page. A hypothesis is not yet a fix, and before you act on one in the middle of an incident you need to see the evidence for yourself. That usually means opening the observability UI in a browser, finding the trace waterfall, pulling up the service map to scope the impact, and checking each view against what the agent said, ping-ponging between tabs while the pressure builds. The agent saved you the query time and left you the tab-switching. Amazon OpenSearch Service &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/opensearch-observability-mcp-app.html" rel="noopener noreferrer"&gt;MCP Apps&lt;/a&gt; move that verification into the chat thread, so the evidence arrives next to the claim. This post builds on &lt;a href="https://medium.com/@jonhandler/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-f4254cda3a55" rel="noopener noreferrer"&gt;Implement Agent Observability: Extend Your OpenTelemetry Stack on Amazon OpenSearch Service&lt;/a&gt;, which covers how agent telemetry joins the OpenTelemetry stack you already run.&lt;/p&gt;

&lt;h2&gt;
  
  
  The proof arrives with the answer
&lt;/h2&gt;

&lt;p&gt;A standard MCP tool call returns text. The agent reasons over it, and you go somewhere else to check it. MCP Apps extend the protocol with a second response channel. If a standard tool call is &lt;code&gt;stdout&lt;/code&gt; only, an MCP App writes to two streams: a structured text summary for the agent, and an interactive visualization that your chat client renders in the conversation thread for you.&lt;/p&gt;

&lt;p&gt;A trace investigation shows how the two halves divide the work. The agent passes a trace ID, or a service name and time range, and the tool returns a summary with the trace ID, total duration, span count, critical path, and where the failure started. The agent uses that text to choose its next step, such as pulling the log entries around the failing span. Meanwhile the same response renders a trace waterfall in the thread, and you can expand spans, inspect their attributes, and confirm the root cause yourself. OpenSearch UI builds that visualization server-side by running the query against your data, so the chart is deterministic. You are looking at the actual query result, not the model's description of it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fas5unv1ineubgeou2dv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fas5unv1ineubgeou2dv0.png" alt=" " width="800" height="506"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;An MCP App renders a checkout trace waterfall in the chat thread, with the span hierarchy, span details, the AI analysis, and suggested next questions in one view. The chat client, &lt;a href="https://github.com/aaif-goose/goose" rel="noopener noreferrer"&gt;Goose&lt;/a&gt; in this case, renders both the text and interactive graphic response.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When checkout errors spike, the whole investigation can start from one question about the cause. The agent queries the alerts, correlates logs with traces, and checks the service map, and its reply carries those views alongside its explanation. The waterfall above comes from exactly that kind of session. The analysis points at CartService/EmptyCart failing with a FailedPrecondition error after about 15 seconds, and the span hierarchy beneath it lets you trace the failure from the load generator through checkout to the cart service yourself. The suggested follow-ups at the bottom, such as showing the logs for this trace or checking cart service health, keep the next step in the same thread, whether that is digging deeper, drafting the incident summary, or starting the remediation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting up the local server
&lt;/h2&gt;

&lt;p&gt;The architecture is a local MCP server that sits between your chat client and an OpenSearch UI application. OpenSearch UI is the serverless interface for observability, and it already connects to your OpenSearch Service domains, OpenSearch Serverless collections, and Amazon Managed Service for Prometheus workspaces. Each tool call goes from your client to the local server, which signs the request with your AWS credentials and forwards it to the OpenSearch UI endpoint. The server runs on your machine, and your data stays in your AWS account. You need an OpenSearch UI application with an Observability workspace connected to at least one data source, Node.js 22 or later, and credentials that allow &lt;code&gt;es:ESHttpGet&lt;/code&gt; and &lt;code&gt;es:ESHttpPost&lt;/code&gt; on the application. Supported clients include Claude Desktop, VS Code with GitHub Copilot, Cursor, Goose, and ChatGPT.&lt;/p&gt;

&lt;p&gt;Download and extract the server package, then add it to your client's MCP configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"opensearch-observability-stack-mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/opensearch-observability-stack-mcp/server/server.js"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"OS_UI_ENDPOINT"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"application-abc123.us-west-2.opensearch.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"AWS_REGION"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"us-west-2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"AWS_PROFILE"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-profile"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The endpoint is the Application URL on the Applications page of the Amazon OpenSearch Service console. Restart the client and ask it to list the available observability data sources. If your domains, collections, or Prometheus workspaces come back, the connection works. The setup creates no cloud resources, so removing it means deleting the configuration entry and the local directory. The &lt;a href="https://aws.amazon.com/blogs/machine-learning/agentic-observability-with-amazon-opensearch-service-mcp-apps/" rel="noopener noreferrer"&gt;launch post&lt;/a&gt; walks through each step.&lt;/p&gt;

&lt;h2&gt;
  
  
  The chat window becomes the console
&lt;/h2&gt;

&lt;p&gt;The previous post made the case for bringing application and agent telemetry together, with logs and traces in OpenSearch Service and metrics in Amazon Managed Service for Prometheus. MCP Apps are where that unification pays off for the person on call. The signals still live in several stores, but the SRE no longer has to remember which store holds which signal or which UI shows it. The agent does that routing, and the chat thread becomes one surface over every source. In that sense the agent is the new user experience for observability: you describe what you need, and the right query against the right store comes back with the right view.&lt;/p&gt;

&lt;p&gt;Behind that surface, each tool handles a different stage of an investigation and returns the view that suits it. Triage tools surface active alerts, correlate them across data sources, and break them down by severity so the agent knows where to start. Log tools search for error patterns and cluster similar entries into a failure signature. Trace tools find the distributed trace and draw the span hierarchy and latency breakdown. To size the impact, metric tools run PromQL with threshold analysis, service performance tools report rate, errors, and duration for each service, and topology tools draw the service map with call volume and error rate on every edge. Dynamic visualization tools build line, bar, area, and metric charts from queries you describe, and a set of specialized tools covers the agents themselves, tracing LLM calls and rendering agent trace maps, alongside cluster health reports and instrumentation scoring that finds gaps in your telemetry coverage.&lt;/p&gt;

&lt;p&gt;With those tools behind it, the console stops being a wall of dashboards you navigate and becomes a conversation you drive. You ask what is wrong, and the waterfall that shows it arrives with the answer. You ask how far it spreads, and the service map renders with the failing edges marked. You ask for the error rate since the last deploy, and the chart is built for that window when you ask, rather than waiting on a dashboard someone had to anticipate.&lt;/p&gt;

&lt;p&gt;Trust in that conversation depends on what sits underneath it. The agent works through your permissions, and every result reports its own status. An empty result means the query finished and found nothing, which is different from a timeout, a partial scan, or a permission denial, and that status carries through each step of the investigation. The same thread can also carry the response. A runbook for a known failure can live as a skill the agent runs, so the procedure and the data it depends on show up together instead of in a wiki tab.&lt;/p&gt;

&lt;p&gt;This approach suits teams that run observability at scale and want to own the stack: large telemetry volumes, engineers who build their own tooling, and a preference for open, extensible components. If you already run OpenSearch for logs or search, the MCP server works against the same engine and the same data you already query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;Agents made root-cause analysis fast, which left verification as the slow step. Amazon OpenSearch Service MCP Apps close that gap by returning each answer twice: as text the agent reasons over, and as a deterministic visualization you can inspect in the same thread. Setup takes a local server, your existing OpenSearch UI application, and your AWS credentials, and the tools cover an investigation from the first alert to the service map. For SREs working alongside agents that investigate at machine speed, the chat window is no longer a lighter view of the observability console. It is the console.&lt;/p&gt;

</description>
      <category>observability</category>
      <category>aiagents</category>
      <category>opensearch</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Implement Agent Observability: Extend Your OpenTelemetry Stack on Amazon OpenSearch Service</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Thu, 22 Oct 2026 17:53:12 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-j57</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-j57</guid>
      <description>&lt;p&gt;You already observe your applications. Agent observability is the same stack, reaching new signals and giving you a new way to investigate.&lt;/p&gt;

&lt;p&gt;You get paged at 2am and work backward from a symptom: which service is erroring, what changed, which log line explains it. That loop is familiar, and your OpenTelemetry stack already feeds it. What is new is that the application now includes agents that reason, call tools, and chain steps, so the same page can turn on what an agent retrieved, which tool call stalled, or why it looped. Amazon OpenSearch Service and its &lt;a href="https://opensearch.org/platform/opensearch-observability/" rel="noopener noreferrer"&gt;observability stack&lt;/a&gt; cover both the agent's execution and the application's behavior in one place, so that investigation stays a single thread instead of splitting across tools. Here is how that comes together.&lt;/p&gt;

&lt;h2&gt;
  
  
  The signal extends
&lt;/h2&gt;

&lt;p&gt;Consider what changes when the thing you are debugging is an agent. You are no longer only asking which service failed. You are asking what the agent retrieved, which tool call stalled, why it looped, and how that cascaded into the application work it triggered. That is new territory for a 2am investigation. It sits on top of the old territory rather than replacing it. The applications you already run do not go away; they gain a new kind of participant whose decisions you now have to see.&lt;/p&gt;

&lt;p&gt;Start with what you are now collecting. Agents do not just emit logs. A single agent request can carry repeated prompts, retrieved context, tool arguments, and results across several iterations, and multi-agent or ReAct workflows push that further still, generating many times the data of a simple application trace. To see what happened inside one, you need the full execution chain: every model call, every tool invocation, every reasoning step. That is agent tracing, and the first thing to understand about it is that it extends what you already collect rather than replacing it.&lt;/p&gt;

&lt;p&gt;The extension is mechanical, not conceptual. Agent traces arrive as OpenTelemetry spans, the same shape as the application spans you already ingest, so they land in the same store and join the same investigation. That shared landing place is the whole reason this works, because an agent's outcome usually cannot be explained from the agent trace by itself. The reason a task failed often surfaces in a downstream service, an application log, or an infrastructure metric that the agent never sees.&lt;/p&gt;

&lt;p&gt;Picture the 2am page again. The agent returned a wrong answer, and its trace shows a tool call that took four seconds and then a retry. On its own that is a shrug. Joined to the downstream spans it triggered, the HTTP call to a search service and the database query behind it, through the identifiers propagated across all of them, the four seconds resolves into a specific slow query on a specific shard. One investigation, not two tools and a spreadsheet of timestamps. Tracing is only the entry point, too: evaluating whether the agent's answers were any good, and analyzing its behavior across sessions, read from this same execution data once it is flowing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The economics tighten
&lt;/h2&gt;

&lt;p&gt;Cost control is not new and not unique to agents; any team ingesting logs and traces at volume already decides what to keep hot, what to tier, and what to drop. What agents change is the scale, because their loops repeat system prompts, tool schemas, retrieved context, and prior results on every pass, and the volume climbs fast enough that a loose retention design turns expensive in a hurry. The architecture that answers this is the one you want for all of your observability data anyway. Incident triage needs full-text search across prompts, tool results, and logs, a &lt;code&gt;grep&lt;/code&gt; for the one line that explains a failure. Fleet analysis needs columnar aggregation over latency, token spend, and error rates across handoffs. Both run on the same retained data, and intelligent tiering moves older data to cheaper storage on its own. It is the same &lt;a href="https://medium.com/@jonhandler/opensearch-unifies-the-retrieval-layer-for-structured-time-series-and-full-text-data-for-your-1a73a6ae36eb" rel="noopener noreferrer"&gt;unified retrieval&lt;/a&gt; idea that lets an agent read text, vectors, and time series through one interface, turned toward operations, so you hold one copy of the truth instead of two systems whose versions drift apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actor changed
&lt;/h2&gt;

&lt;p&gt;The deepest shift is who is asking. Investigation agents are becoming first-line consumers of operational data, and that is the part that upgrades the stack rather than merely extending it. An agent is good at inferring causes, but only from signals it can trust, and that puts a new demand on the interface it queries: results and their status have to be unambiguous. An empty result has to mean the query completed and found nothing, distinct from a timeout, a partial scan, a stale handle, or a permission denial. A human reads a half-empty chart and senses something is off; an agent takes the bytes at face value, so if the store conflates those cases the agent reasons confidently from a false premise. That status has to travel with the result through every step, because a wrong signal early becomes a confident wrong conclusion later.&lt;/p&gt;

&lt;p&gt;This takes nothing away from how you work today. You keep investigating visually when that is the fastest path, and the agent works the same data through an interface built for a machine reader. Teams run many observability tools, so some data will always live outside any single store. The investigation has to cross those sources without copying everything into one system first. What you add is additive: the same OpenTelemetry data you already trust, now also legible to an agent that can act on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Standing it up
&lt;/h2&gt;

&lt;p&gt;Putting this in place is mostly a matter of pointing instrumentation you already run at stores built for it. &lt;a href="https://opensearch.org/platform/opensearch-observability/" rel="noopener noreferrer"&gt;OpenSearch observability&lt;/a&gt; ingests OpenTelemetry natively. Logs and traces land in Amazon OpenSearch Service as the store for full-text search and correlation, while metrics go to Amazon Managed Service for Prometheus as the store for time-series analysis, and OpenSearch UI visualizes both together so a metric spike and the traces behind it sit on one screen. The stack correlates an agent step to the application work it triggered and tiers data by age so retention stays affordable. Because the ingestion path is OpenTelemetry, reaching from application observability to agent observability means sending the new spans, not re-platforming: you keep your query languages, your dashboards, and your pipelines, and the agent signal joins them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it together
&lt;/h2&gt;

&lt;p&gt;Put the three shifts together and the picture is simple. The signal extends, because agent traces are OpenTelemetry spans that land beside the application telemetry you already keep. The economics stay the ones you already manage, made more urgent by the volume an agent loop generates. And the investigator can now be an agent, which is what turns a bigger haystack into faster answers instead of slower ones. None of that asks you to replace your observability practice. It asks you to point the instrumentation you already run at a store built to hold all of it, and to let an agent read what it finds.&lt;/p&gt;

&lt;p&gt;That is the foundation the next step builds on. Once application and agent telemetry live together and an agent can query them and trust the results, a chat interface can sit over the whole thing and the investigation moves into a conversation. See &lt;a href="https://medium.com/@jonhandler/implement-agent-observability-extend-your-opentelemetry-stack-on-amazon-opensearch-service-f4254cda3a55" rel="noopener noreferrer"&gt;Implement Agent Observability: Extend Your OpenTelemetry Stack on Amazon OpenSearch Service&lt;/a&gt; on Medium for a fuller treatment, with a deep dive to come.&lt;/p&gt;

</description>
      <category>observability</category>
      <category>aiagents</category>
      <category>vectorsearch</category>
      <category>airetrieval</category>
    </item>
    <item>
      <title>Connect your Strands agent to Amazon OpenSearch Service</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Thu, 15 Oct 2026 15:09:09 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/connect-your-strands-agent-to-amazon-opensearch-service-b5</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/connect-your-strands-agent-to-amazon-opensearch-service-b5</guid>
      <description>&lt;p&gt;&lt;em&gt;Your agent is only as good as what it can look up. Point it at OpenSearch Service and give it hybrid search as a tool.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An AI agent reasons well and knows little. The model is frozen at training time, so anything specific to your business, your product catalog, your support history, your internal docs, lives outside it. The agent gets that knowledge the same way an application does: it searches for it. The question is what it searches, and how well.&lt;/p&gt;

&lt;p&gt;Amazon OpenSearch Service is the shortest path to that knowledge source. It already holds your text, and it can run lexical and semantic search over the same index, so an agent can retrieve by keyword and by word-context similarity in a single call. This post wires a &lt;a href="https://strandsagents.com/docs/user-guide/sdk/quickstart/python/" rel="noopener noreferrer"&gt;Strands&lt;/a&gt; agent to Amazon OpenSearch Serverless with two short pieces of code: the agent itself, and a hybrid search tool it can call. Serverless means you do not size or manage a cluster; you create a collection, point the agent at it, and let it scale on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  The agent is a handful of lines
&lt;/h2&gt;

&lt;p&gt;In Strands, the model is the agent. You hand it a set of tools, and it reasons about when to call them, reads what they return, and keeps going until it has an answer. Amazon Bedrock backs it by default, so there is no model object to construct up front. What you write is small: an import, a system prompt that tells the agent to ground its answers in what it retrieves, the tool it can call, and the question.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;strands&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;opensearch_hybrid_search&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;system_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Answer using the knowledge base. Retrieve before you answer, and cite what you used.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What changed in our refund policy last quarter?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application receives a user's question, pulls together whatever it already knows, the session, the user's recent activity, any context it is holding, and hands that to the agent. The agent decides it needs to look something up, calls the knowledge-base tool, reads the passages that come back, and grounds its answer in them rather than in whatever the model happened to memorize at training time. Agents rarely stop at one tool call, though; they loop, calling a tool, reasoning over what it returned, and calling again until they have enough to answer. Think of it as a Unix pipe with judgment: question | retrieve | reason | answer, except the agent runs that loop itself and decides how many times to go around before it responds.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tool is a hybrid query against OpenSearch Service
&lt;/h2&gt;

&lt;p&gt;The tool runs a hybrid query with two clauses. One is lexical, a BM25 &lt;code&gt;match&lt;/code&gt; that locks onto exact terms, product codes, and names. The other is &lt;code&gt;neural&lt;/code&gt;, a clause that ranks documents by how closely their word-context patterns align with the query's, so it surfaces relevant passages whose wording differs from the words the user typed. A search pipeline normalizes the two score scales and combines them, so a single request returns one ranked list drawn from both signals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;opensearch_hybrid_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Search the knowledge base for passages relevant to the query.
    Use for any question about company-specific information.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hybrid&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;queries&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;match&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;}}},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;neural&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text_embedding&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query_text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MODEL_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;k&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;}}}&lt;/span&gt;
      &lt;span class="p"&gt;]}}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;kb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;search_pipeline&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hybrid-pipeline&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;_source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hits&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hits&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two fields on the index make this work: &lt;code&gt;text&lt;/code&gt; holds the raw passage for the lexical clause, and &lt;code&gt;text_embedding&lt;/code&gt; holds its vector for the &lt;code&gt;neural&lt;/code&gt; clause. The search pipeline, created once on the collection, carries the normalization and combination settings so the query body stays this small. The tool hands back a list of passage strings, which is exactly what the agent needs to read and cite.&lt;/p&gt;

&lt;p&gt;One point worth stressing, because it is where hybrid search quietly fails: both legs have to be good. Hybrid search amplifies every signal you give it, so a noisy lexical configuration produces noisy combined results. Adding a semantic clause does not paper over a weak BM25 setup. Tune the keyword side as carefully as the vector side, and the combination rewards you; neglect it, and the combination carries the noise straight through.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the embeddings in: the easy path and the direct path
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;neural&lt;/code&gt; clause needs a vector for each document, and you have two ways to produce them. The easy path is &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/opensearch-semantic-enrichment.html" rel="noopener noreferrer"&gt;automatic semantic enrichment&lt;/a&gt;: you enable it on a text field, and Amazon OpenSearch Service expands that field into a sparse vector with a service-managed model at ingestion, with no embedding pipeline to wire up and no model to host. Because the model runs at ingest and queries are only tokenized, the matching clause for this path is a &lt;code&gt;neural_sparse&lt;/code&gt; query rather than the dense &lt;code&gt;neural&lt;/code&gt; clause shown above. For most teams this is where to start, because it removes the step that usually stalls a first vector project.&lt;/p&gt;

&lt;p&gt;The direct path is to supply your own dense vectors. You run your embedding model, write the vectors into a &lt;code&gt;knn_vector&lt;/code&gt; field yourself, and query them with the dense &lt;code&gt;neural&lt;/code&gt; clause, keeping full control over the model, its dimensions, and when you re-embed. Reach for it when you have a specific model you need to use or you are already generating embeddings elsewhere in your stack. The hybrid structure is the same either way; the one clause that changes is whether you match the enriched field with &lt;code&gt;neural_sparse&lt;/code&gt; or the dense field with &lt;code&gt;neural&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Point the agent at the knowledge source
&lt;/h2&gt;

&lt;p&gt;This post covers the bare-bones interaction between the application and the agent, giving you the idea on how to create and use an agent. In a real production system, the lexical clause would grow filters, boosts, and field weights tuned to your data instead of a bare match. The agent would carry more than one tool: guardrails that keep it inside policy, a step that evaluates whether the retrieved passages are good enough before it answers, and often separate lexical and vector tools with a planning step that decides which to call for a given question. You might split retrieval across several indexes, add reranking, or let the agent reformulate a query that came back thin.&lt;/p&gt;

&lt;p&gt;An agent with no knowledge source guesses; an agent with a good one answers. An Amazon OpenSearch Serverless collection holds your knowledge, automatic semantic enrichment gets the vectors in without an embedding pipeline, and one hybrid search tool gives the agent lexical precision and semantic reach in a single call. The agent code is a dozen lines, the tool is a dozen more, and the retrieval underneath them is the part that decides whether the answers are any good. Build the knowledge source well, and the agent gets smarter for free.&lt;/p&gt;

</description>
      <category>vectorsearch</category>
      <category>airetrieval</category>
      <category>opensearch</category>
      <category>aiagents</category>
    </item>
    <item>
      <title>Dial in your search with User Behavior Insights: from clicks to accurate results</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Tue, 13 Oct 2026 13:20:06 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/dial-in-your-search-with-user-behavior-insights-from-clicks-to-accurate-results-3k60</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/dial-in-your-search-with-user-behavior-insights-from-clicks-to-accurate-results-3k60</guid>
      <description>&lt;p&gt;&lt;em&gt;Users grade your search results by acting on them. Write down the grades yourself, and use them to make the results better.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every action a user takes on a search result, a click, a hover, an add-to-cart, a purchase, tells you whether the ranking was right. Most search systems let that signal fall on the floor. Capture it instead and you get a continuous stream of relevance judgments, generated by the people who actually know what they were looking for, at zero labeling cost. That stream is what turns relevance tuning from guesswork into measurement.&lt;/p&gt;

&lt;p&gt;The problem is that most teams have no structured record of what their users do. They know the query volume and maybe the zero-result rate, but they cannot answer the question a data scientist actually asks: for this query, which results did we show, and which ones did the user click? Without the causal link between a query, the results it returned, and the actions taken on those results, every relevance decision is an opinion.&lt;/p&gt;

&lt;p&gt;User Behavior Insights (UBI) is the OpenSearch answer to that gap. Introduced in OpenSearch 2.15 and built on &lt;a href="https://docs.opensearch.org/latest/search-plugins/ubi/index/" rel="noopener noreferrer"&gt;an open specification&lt;/a&gt;, UBI is a schema and a collection path for recording search behavior: the queries users submit, the results shown, and the actions taken on those results, all linked together. This post covers what UBI captures and how to collect it in Amazon OpenSearch Service. More to the point, it shows how to turn that data into results that move the numbers you care about: more of the purchases, answers, and signups your search is supposed to produce, fewer dead-end queries that send customers elsewhere, and retrieval your agents can actually trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  What UBI actually records
&lt;/h2&gt;

&lt;p&gt;UBI separates two kinds of records and ties them together. Query records capture what was searched and what the engine returned, with an identifier for the query. Event records capture what the user did next: a click, a scroll, an add-to-cart, a conversion, each tagged with &lt;a href="https://docs.opensearch.org/latest/search-plugins/ubi/schemas/" rel="noopener noreferrer"&gt;the same query identifier&lt;/a&gt; so you can trace an action back to the exact result set that produced it. Plenty of analytics tools count clicks, but counting is not the same as explaining. UBI records which query showed which results, in which positions, and which result the user acted on, so you can judge whether a ranking did its job.&lt;/p&gt;

&lt;p&gt;Because the schema is an open specification rather than a proprietary log format, the data you collect is portable and interoperable across tools that speak UBI. That matters when you want the behavior data to feed more than one consumer: a relevance dashboard, an offline evaluation harness, and a tuning workflow can all read the same records without a bespoke export for each.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collecting behavior data in Amazon OpenSearch Service
&lt;/h2&gt;

&lt;p&gt;The client side is where behavior originates, so UBI ships an optional &lt;a href="https://docs.opensearch.org/latest/search-plugins/ubi/ubi-javascript-collector/" rel="noopener noreferrer"&gt;JavaScript collector&lt;/a&gt; that manages the query identifier for a search and records events against it as the user interacts with the results. Your web page or app initializes the collector, associates it with each query, and sends click and action events as they happen. The collector handles the lifecycle of tying events back to the originating query so you do not hand-roll that plumbing.&lt;/p&gt;

&lt;p&gt;On the server side, the open-source UBI plugin can record query data directly, avoiding a round trip to the client for the query and result payload. The plugin is part of open-source OpenSearch and is not bundled into Amazon OpenSearch Service, but you do not need the plugin to adopt UBI. Amazon OpenSearch Service documents &lt;a href="https://docs.opensearch.org/latest/search-plugins/ubi/ubi-aws-managed-services-tutorial/" rel="noopener noreferrer"&gt;a supported path for collecting UBI-formatted data&lt;/a&gt; by sending query and event records to UBI indices directly, so the managed service stores and analyzes the same schema. The data lands in OpenSearch indices, which means you query and visualize it with the same tools you already use for search.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning behavior into relevance
&lt;/h2&gt;

&lt;p&gt;Once the events are flowing, the metrics that were previously anecdotes become queries you can run. Zero-result rate, click-through rate by position, the share of sessions that refine a query and search again, and the rank of the result users actually click all come straight out of the UBI indices, through &lt;a href="https://docs.opensearch.org/latest/search-plugins/ubi/sql-queries/" rel="noopener noreferrer"&gt;query DSL or SQL in the Query Workbench&lt;/a&gt;. A dashboard over those indices turns the stream into a picture of where search is winning and where it is losing.&lt;/p&gt;

&lt;p&gt;The behavior data also drives OpenSearch features built on top of the UBI specification. The open-source Search Relevance Workbench uses judgments derived from behavior to evaluate and compare ranking configurations, and its Hybrid Search Optimizer uses the same data to sweep normalization and weighting settings for hybrid search rather than making you guess at them. Those same behavior-derived judgments feed &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/learning-to-rank.html" rel="noopener noreferrer"&gt;Learning to Rank&lt;/a&gt;: the Workbench turns UBI events into implicit judgment lists, and Learning to Rank, available in Amazon OpenSearch Service, trains an XGBoost or RankLib model on them to rescore results with behavioral signals that BM25 alone never sees. The click that a user made yesterday becomes an input to the ranking they see tomorrow. That is the feedback loop that separates a search system that improves from one that just runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Behavior data for agentic search
&lt;/h2&gt;

&lt;p&gt;Your users are no longer the only ones searching. Agents now run retrievals too, and they leave behavior signals of their own. When an agent runs a retrieval, reads the results, and picks which passages to use in its answer, that selection is a relevance judgment in the same way a human click is. Record agent interactions in the UBI schema and you get a behavior stream for agent traffic alongside the human one, so you can see which retrievals actually fed answers and which the agent threw away. The stakes are higher than they look: an agent that retrieves the wrong passages produces a confidently wrong answer, and without behavior capture you hear about it from a user complaint instead of your own data.&lt;/p&gt;

&lt;p&gt;Capturing all of this behavior is worth it on its own, but it also feeds something that pays it back. &lt;a href="https://opensearch.org/blog/agentic-relevance-tuning/" rel="noopener noreferrer"&gt;Agentic relevance tuning&lt;/a&gt;, delivered through the OpenSearch Relevance Agent introduced as an experimental feature in OpenSearch 3.6, takes the complexity out of relevance tuning by working directly from your UBI data. Through a natural-language chat in OpenSearch Dashboards, it reads the behavior you have captured to find where ranking falls short, proposes tuning strategies from what it finds, and validates them against offline evaluation sets before anything ships. Tuning that used to take a search expert weeks becomes a conversation, and it keeps you as the decision-maker rather than changing your ranking behind your back. The behavior stream this article is about is the fuel: the richer your UBI data, the more the agent has to reason over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start recording
&lt;/h2&gt;

&lt;p&gt;The behavior data you need to improve search is being generated right now, on every query your users and agents run, and it disappears the moment you fail to record it. UBI is the path to keeping it: an open schema, a client collector, and a supported collection path in Amazon OpenSearch Service, all landing in indices you already know how to query. Instrument the queries that matter, watch what users and agents do with the results, and let the grades they have been giving you all along drive what you ship next.&lt;/p&gt;

</description>
      <category>vectorsearch</category>
      <category>airetrieval</category>
      <category>opensearch</category>
      <category>searchrelevance</category>
    </item>
    <item>
      <title>From 1.3 TB to 66 GB: On-Disk Vector Search in OpenSearch</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Thu, 08 Oct 2026 16:21:14 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/from-13-tb-to-66-gb-on-disk-vector-search-in-opensearch-fee</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/from-13-tb-to-66-gb-on-disk-vector-search-in-opensearch-fee</guid>
      <description>&lt;p&gt;&lt;em&gt;The last turn of the dial. Move the full-precision vectors to disk, stack a few more savings, and pay for the latency you actually need.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first two articles in this series shrank the vectors and kept them in memory. &lt;a href="https://medium.com/@jonhandler/1-3-tb-of-ram-for-100m-vectors-shrink-them-before-they-hit-opensearch-01fca4f32821" rel="noopener noreferrer"&gt;1.3 TB of RAM for 100M Vectors? Shrink Them Before They Hit OpenSearch&lt;/a&gt; covered pre-quantized vectors, where you convert to FP16, byte, or binary before indexing. &lt;a href="https://medium.com/@jonhandler/native-quantization-let-opensearch-service-compress-your-vectors-bc7fe8fc5528" rel="noopener noreferrer"&gt;Native Quantization: Let OpenSearch Service Compress Your Vectors&lt;/a&gt; handed that conversion to the engine at index time, from 16-bit scalar quantization down to 32x with optimized scalar quantization. Both kept the working set in RAM, where search answers in milliseconds.&lt;/p&gt;

&lt;p&gt;This article takes the last turn of the dial: it moves the full-precision vectors to disk. Amazon OpenSearch Service keeps a compressed copy in memory and searches it first, then reads the full-precision vectors from disk to rescore the best candidates. For a replicated index of 100 million embeddings at 1,536 dimensions, that drops resident memory from about 1.3 TB, the best-latency deployment with everything in RAM, to roughly 66 GB. The price is some added search latency. A few stacking techniques, covered later, trim the footprint further.&lt;/p&gt;

&lt;h2&gt;
  
  
  On-disk mode: compressed in memory, full precision on disk
&lt;/h2&gt;

&lt;p&gt;Disk-based vector search, introduced in OpenSearch 2.17, runs a search in two phases. The compressed vectors stay resident in memory, and OpenSearch searches them first to gather more candidates than you asked for. Then it loads the full-precision vectors for those candidates from disk and rescores them, returning the top k by true similarity. The large full-precision copy lives on the secondary storage tier, not in RAM, which is where the memory savings come from. Rescoring is on by default, with an oversample factor of 2.0 at the default 32x compression, so recall stays strong despite the compressed first pass.&lt;/p&gt;

&lt;p&gt;You enable it with a single field-level parameter, &lt;code&gt;mode&lt;/code&gt; set to &lt;code&gt;on_disk&lt;/code&gt;. By default that selects the Faiss engine, the HNSW method, and 32x compression, which routes through the optimized scalar quantizer OpenSearch uses at that level, bringing a replicated 100-million-vector index down to roughly 66 GB resident. The mode works with the &lt;code&gt;float&lt;/code&gt; and &lt;code&gt;half_float&lt;/code&gt; data types. To trade some of the savings back for recall, lower the compression with &lt;code&gt;compression_level&lt;/code&gt;; at 4x, OpenSearch uses the Lucene engine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-ondisk-index&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"index.knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knn_vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dimension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"space_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"l2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"data_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"float"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"mode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"on_disk"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Latency is the thing to measure. In-memory search runs every comparison at RAM speed. On-disk search adds a second pass that reads full-precision vectors from the storage tier, so SSD throughput sets the pace. In the &lt;a href="https://opensearch.org/blog/Reduce-Cost-with-Disk-based-Vector-Search/" rel="noopener noreferrer"&gt;OpenSearch project's disk-based search benchmark&lt;/a&gt; on 113 million 1,024-dimension vectors, on-disk search at 32x answered in about 100 milliseconds at p90 with a single client, compared with about 24 milliseconds for the uncompressed in-memory index. Latency climbs as concurrency rises, so test at your real query load. For RAG, agent, and batch workloads that is usually a good trade. For the tightest user-facing latency budgets, keep the working set in RAM with one of the in-memory options from the earlier articles.&lt;/p&gt;

&lt;p&gt;A useful pattern runs two indexes on one cluster: an in-memory quantized index for interactive, user-facing queries, and an on-disk index for batch or background work such as overnight RAG precomputation or periodic analytics over the full corpus. Each is sized for its own latency target, so you are not paying RAM prices for queries that can wait.&lt;/p&gt;

&lt;h2&gt;
  
  
  Derived source: cut disk storage, not just RAM
&lt;/h2&gt;

&lt;p&gt;Derived source saves disk, not memory. Everything else in this series shrinks what sits in RAM; this setting shrinks what sits on disk. Without it, OpenSearch keeps a full copy of every vector in the stored &lt;code&gt;_source&lt;/code&gt; field, alongside the vector data the search structures already hold, so each vector is stored twice. Derived source drops that copy from &lt;code&gt;_source&lt;/code&gt; and rebuilds the values on demand, so the update, update_by_query, and reindex APIs keep working. Less data on disk also makes search faster: in the &lt;a href="https://opensearch.org/blog/do-more-with-less-save-up-to-3x-on-storage-with-derived-vector-source/" rel="noopener noreferrer"&gt;OpenSearch benchmarks for derived vector source&lt;/a&gt;, storage dropped by 3x, force merges ran about 10% faster, and search latency on the Lucene engine fell by 90%, because less unneeded vector data moves through the page cache. Derived source is on by default for vector indexes on OpenSearch 3.0 and later, and it matters most for on-disk indexes, where the full-precision vectors already occupy the storage tier. For an index created before the default, check &lt;code&gt;index.knn.derived_source.enabled&lt;/code&gt;; the setting is static, so turning it on means reindexing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Serving indexes larger than memory, handled for you
&lt;/h2&gt;

&lt;p&gt;You do not have to load an entire Faiss index into memory to search it. Memory-optimized search, introduced in OpenSearch 3.1, memory-maps the index file and lets the operating system file cache serve reads, so a node can hold indexes larger than its physical memory and repeated queries come from cache. When you choose on-disk mode, or 32x compression with the optimized scalar quantizer, OpenSearch applies it for you behind the scenes. You can also turn it on explicitly for any Faiss HNSW index with a single index setting. On instances with large local memory and NVMe storage, memory-mapping raises effective capacity per node, with occasional p99 variability when a read misses the cache. The setting is static, so for an existing index you close the index, update the setting, and reopen it. It applies to Faiss HNSW only; IVF and product quantization indexes still load into memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-vector-index&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"index.knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"index.knn.memory_optimized_search"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knn_vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dimension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"space_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"l2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hnsw"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"engine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"faiss"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  IVF with product quantization for billion-scale
&lt;/h2&gt;

&lt;p&gt;HNSW is the default graph for most workloads, but at billion scale even a quantized graph can exceed the memory budget. Faiss offers an alternative: an inverted file (IVF) index combined with product quantization. IVF partitions the vector space into clusters with k-means and searches only the clusters near the query, while product quantization encodes each vector into a compact set of codes. There is no navigation graph to hold, so the footprint is smaller than HNSW, at the cost of a training step to learn the cluster centroids and codebooks, and typically lower recall than HNSW at the same latency. Reach for IVF with product quantization when you have billions of vectors and cost is the binding constraint. IVF is available only on the Faiss engine; the Lucene engine supports HNSW and flat indexes but not IVF. Like all product quantization, it requires training before you index.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reminders from earlier in the series
&lt;/h2&gt;

&lt;p&gt;A few techniques from the earlier articles stack with everything here. When a filter narrows the candidates to roughly 100,000 vectors or fewer, exact k-NN skips the graph entirely and returns perfect recall with no graph to hold in memory. On nodes dedicated to vector search, raising the k-NN memory circuit breaker, &lt;code&gt;knn.memory.circuit_breaker.limit&lt;/code&gt;, above its 50% default fits more vectors per node before you add hardware. And GPU-accelerated graph construction cuts build times for full-corpus rebuilds and embedding-model upgrades; see &lt;a href="https://aws.amazon.com/blogs/aws/amazon-opensearch-service-improves-vector-database-performance-and-cost-with-gpu-acceleration-and-auto-optimization" rel="noopener noreferrer"&gt;the GPU acceleration write-up&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The full spectrum, end to end
&lt;/h2&gt;

&lt;p&gt;Here is the whole dial across the three articles, measured against the same baseline: 100 million vectors at 1,536 dimensions, HNSW with m of 16, one replica. RAM figures are the resident footprint with the replica. Dollar figures are order-of-magnitude on demand before reserved-instance or savings-plan discounts, meant to show relative magnitude, not quote a price.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Resident RAM (with replica)&lt;/th&gt;
&lt;th&gt;p50 latency&lt;/th&gt;
&lt;th&gt;Recall&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FP32 baseline&lt;/td&gt;
&lt;td&gt;~1.3 TB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;reference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FP16 / SQ 16-bit&lt;/td&gt;
&lt;td&gt;~656 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;indistinguishable from FP32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;INT8 / byte&lt;/td&gt;
&lt;td&gt;~341 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;0.99 on Euclidean sets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQ 4-bit (8x)&lt;/td&gt;
&lt;td&gt;~184 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;0.94-0.98 with rescoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQ 2-bit (16x)&lt;/td&gt;
&lt;td&gt;~105 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;moderate, benchmark it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OSQ 1-bit (32x)&lt;/td&gt;
&lt;td&gt;~66 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;0.94-0.98 with rescoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product quantization&lt;/td&gt;
&lt;td&gt;~42 GB&lt;/td&gt;
&lt;td&gt;single-digit ms&lt;/td&gt;
&lt;td&gt;moderate, codec-dependent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;On-disk (32x default)&lt;/td&gt;
&lt;td&gt;~66 GB resident + FP32 on disk&lt;/td&gt;
&lt;td&gt;~100 ms p90 (benchmark)&lt;/td&gt;
&lt;td&gt;strong, two-phase rescoring&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Dimensionality reduction stacks on every row. If your embedding model emits shorter vectors, or you apply principal component analysis or Matryoshka truncation, cutting 1,536 dimensions to 768 roughly halves each RAM figure again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up the series: pick your point on the dial
&lt;/h2&gt;

&lt;p&gt;Across all three articles, the choice comes down to a tradeoff among cost, latency, and accuracy. You can hold any two steady by giving up some of the third. Every step down the table saves memory and pays for it in recall or in latency, and oversampling with rescoring buys recall back at a latency cost. No setting is right for every workload; the right one is the point where your recall and latency requirements still hold at the lowest cost.&lt;/p&gt;

&lt;p&gt;Two settings make good middle grounds. FP16, either pre-quantized &lt;code&gt;half_float&lt;/code&gt; vectors or 16-bit scalar quantization in the engine, halves memory to about 656 GB with recall effectively indistinguishable from full precision and no change in latency. It is the lowest-risk first step. At the other end, 32x compression on disk takes the same index to about 66 GB resident, around a twentieth of the baseline, and two-phase rescoring against the full-precision vectors keeps recall strong, around 95% recall@100 in the &lt;a href="https://opensearch.org/blog/Reduce-Cost-with-Disk-based-Vector-Search/" rel="noopener noreferrer"&gt;OpenSearch disk-based search benchmark&lt;/a&gt;. The cost is latency, about 100 milliseconds at p90 in that benchmark, which suits RAG, agent, and batch workloads. Between the two, you can cover a wide range of workloads without exotic configuration.&lt;/p&gt;

&lt;p&gt;You do not have to walk the dial by hand. &lt;a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-auto-optimize.html" rel="noopener noreferrer"&gt;Auto-optimize for Amazon OpenSearch Service&lt;/a&gt; takes your vectors from Amazon S3, along with the recall and latency you need, and evaluates HNSW parameters, quantization, and rescoring settings against them. It returns up to three recommended configurations, typically within 30 to 60 minutes. The jobs run on separate infrastructure that OpenSearch Service manages, so they don't consume resources on your domain, and each job is billed at a flat rate. That makes it a simple, cost-effective way to explore the dial on your own data before you commit to a configuration.&lt;/p&gt;

&lt;p&gt;Whichever setting you choose, measure it. Start from a full-precision baseline on your own evaluation queries, record recall and p50 and p95 latency, and compare every option against it. The right point moves as the corpus grows, the embedding model changes, and the accuracy requirement shifts, so build recall measurement into the deployment pipeline and re-check when the inputs change.&lt;/p&gt;

</description>
      <category>vectorsearch</category>
      <category>airetrieval</category>
      <category>opensearch</category>
      <category>quantization</category>
    </item>
    <item>
      <title>Native Quantization: Let OpenSearch Service Compress Your Vectors</title>
      <dc:creator>Jon Handler</dc:creator>
      <pubDate>Tue, 06 Oct 2026 21:51:48 +0000</pubDate>
      <link>https://dev.to/jon_handler_9bb3e6b4a2fd0/native-quantization-let-opensearch-service-compress-your-vectors-50e7</link>
      <guid>https://dev.to/jon_handler_9bb3e6b4a2fd0/native-quantization-let-opensearch-service-compress-your-vectors-50e7</guid>
      <description>&lt;p&gt;&lt;em&gt;Send FP32, get 2x to 32x compression, and leave your ingestion pipeline untouched. The engine does the work.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The previous article in this series put the quantization work on you. You convert vectors to a reduced precision before indexing, and Amazon OpenSearch Service stores exactly what you send. That gives you full control, and it gives you a standing job: pick a method, run the conversion in your pipeline, and re-check accuracy every time your embedding model changes.&lt;/p&gt;

&lt;p&gt;There is another way. OpenSearch Service can compress at index time. You send the full-precision FP32 vectors your embedding model already produces, and the engine converts each one to a lower-bit representation during ingestion and stores the compressed vectors in the index. Both the Faiss and Lucene engines offer native quantization, each with its own methods. Your ingestion pipeline does not change. The control over the accuracy tradeoff moves out of your code and into index configuration.&lt;/p&gt;

&lt;p&gt;The baseline is the same one from the previous article. At 100 million vectors of 1,536 dimensions, full-precision FP32 needs about 643 GB for one copy, roughly 1.3 TB with a replica. That figure is the best-latency deployment, holding every vector in memory; with memory-optimized loading you can serve the same index in less RAM and page from disk at some latency cost. Every option here reduces the footprint while leaving ingestion identical. This is the second of three articles on the quantization spectrum in OpenSearch Service. The first covered pre-quantized vectors. The third covers on-disk mode and cost stacking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scalar quantization: the engine compresses each dimension
&lt;/h2&gt;

&lt;p&gt;Faiss scalar quantization is the native path you reach for first. You set the encoder on the &lt;code&gt;knn_vector&lt;/code&gt; field to &lt;code&gt;sq&lt;/code&gt; and give it a bits value, and OpenSearch Service converts each FP32 dimension to the target precision during ingestion, storing the quantized vectors in the index. Valid bit widths are 16, 4, 2, and 1, spanning the range from near-lossless to aggressive compression.&lt;/p&gt;

&lt;p&gt;At 16 bits, scalar quantization halves memory, the same reduction as pre-quantized FP16, dropping a replicated 100-million-vector index to about 656 GB, without a conversion step in your pipeline. OpenSearch stores the 16-bit vectors and builds the HNSW graph over them, and at search time it computes distances directly on the 16-bit values, accelerated by SIMD instructions on recent processors, so there is no round trip back to full precision. The type parameter selects the 16-bit format: fp16, the default, for the highest precision within a plus or minus 65,504 range, or bf16 (introduced in OpenSearch 3.9) for the full 32-bit value range at slightly lower precision. A companion clip parameter governs fp16 only: left at its default it rejects any vector with a value outside the fp16 range, and set to true it rounds out-of-range values to the limits instead. Both type and clip apply to 16-bit quantization only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-sq-index&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"index.knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knn_vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dimension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"space_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"l2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hnsw"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"engine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"faiss"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"m"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"ef_construction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"encoder"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sq"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"bits"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The low-bit end: 1, 2, and 4-bit quantization
&lt;/h2&gt;

&lt;p&gt;Below 16 bits, scalar quantization reaches the aggressive end of the range. Multi-bit scalar quantization added two-bit (16x) and four-bit (8x) options for Faiss in OpenSearch 3.9, and one-bit (32x) has been available since OpenSearch 3.6. These bit widths are supported for the HNSW method. You configure the multi-bit options by setting the &lt;code&gt;sq&lt;/code&gt; encoder bits to 2 or 4, or &lt;code&gt;compression_level&lt;/code&gt; on the field to 8x or 16x. For the 32x end, set &lt;code&gt;compression_level&lt;/code&gt; to 32x and let OpenSearch choose the algorithm, which since 3.7 is the optimized scalar quantizer described below. At 32x, a replicated 100-million-vector index drops to about 66 GB, from the 1.3 TB FP32 baseline. Collapsing each dimension toward a single bit discards magnitude, so benchmark against your own data; at 32x the optimized scalar quantizer recovers much of that recall for you, as the next section describes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-sq&lt;/span&gt;&lt;span class="mi"&gt;-2&lt;/span&gt;&lt;span class="err"&gt;bit-index&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"index.knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knn_vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dimension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"space_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"l2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hnsw"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"engine"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"faiss"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"encoder"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sq"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"bits"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The 32x path: optimized scalar quantization on both engines
&lt;/h2&gt;

&lt;p&gt;At the 32x end of the dial, OpenSearch Service uses optimized scalar quantization (OSQ), a RaBitQ-derived technique that compresses float32 vectors down toward a bit per dimension while holding recall far better than naive binary rounding. Where naive binary quantization centers each vector on the global centroid and rounds, OSQ adds a calibration step: it computes statistics, optimizes the quantization intervals, and keeps small corrective factors with each vector that sharpen the distance estimates. The payoff is a better compression-to-quality ratio at the same 32x reduction. You do not pick the algorithm by hand. Starting in OpenSearch 3.7, asking for 32x compression selects OSQ automatically, and OpenSearch applies it across both the Faiss and Lucene engines, handling the underlying mechanism for you. Set the compression level and let the engine choose.&lt;/p&gt;

&lt;p&gt;The reason OSQ holds recall at roughly a bit per dimension is a set of techniques OpenSearch applies for you, with no knobs to turn. It keeps small corrective factors with each quantized vector so the first-pass distances stay close to the true ones. It uses asymmetric distance computation, keeping the query vector at full precision and rescaling it to compare meaningfully against the compressed document vectors, so the query side keeps information the documents gave up. And it applies a random rotation that spreads variance across dimensions, so more signal survives the compression. Each of these was once a separate option to wire up by hand; at 32x, OpenSearch does all of it under the covers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-osq-index&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"index.knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"knn_vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dimension"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"space_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"l2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"compression_level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"32x"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Product quantization, briefly
&lt;/h2&gt;

&lt;p&gt;Product quantization (PQ) is the one native method that works differently enough to call out. Instead of reducing the precision of each dimension, PQ splits each vector into m subvectors and encodes each one against a learned codebook, reaching compression ratios beyond what scalar quantization offers. The cost is a training step: PQ runs k-means over a representative sample to build the codebooks before you can index, which scalar quantization does not require. That training requirement, plus a larger accuracy gap at high compression, makes PQ a fit for very large corpora, hundreds of millions to billions of vectors, where the savings justify the added operational step. For the parameters and the training workflow, see the OpenSearch product quantization documentation.OpenSearch product quantization documentation&lt;/p&gt;

&lt;h2&gt;
  
  
  Oversampling to recover accuracy
&lt;/h2&gt;

&lt;p&gt;The low-bit methods search over reduced-precision vectors, so the first-pass scores are approximate. Across these methods, you raise recall at query time with oversampling: set an &lt;code&gt;oversample_factor&lt;/code&gt; and OpenSearch retrieves that multiple of k candidates before ranking, trading latency for accuracy, with 2x to 4x a reasonable starting point. The same &lt;code&gt;rescore.oversample_factor&lt;/code&gt; parameter applies whether you are running scalar quantization or the optimized scalar quantizer at 32x. Measure recall and latency together on your own evaluation set, because the right oversampling depends on your data and your bit width.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;GET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/my-sq-index/_search&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"knn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"vector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"k"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"method_parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"ef_search"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"rescore"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"oversample_factor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;3.0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  When exact k-NN is the better call
&lt;/h2&gt;

&lt;p&gt;In-engine quantization still builds and searches an HNSW graph, and that graph is what holds memory. When your queries pre-filter to a small candidate set, you can skip the graph entirely. Exact k-NN scores the query against every vector that passes the filter, with no graph to build or hold in RAM, and when a structured filter narrows the field to roughly 100,000 vectors or fewer it returns perfect recall at latency competitive with the approximate path. It stacks with quantization too: a quantized exact scan over a filtered subset is both small and precise. Reach for exact k-NN when the access pattern is search within this tenant, this category, this date range rather than search the whole corpus. The graph earns its memory only when the candidate set stays large.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the method, keep the pipeline
&lt;/h2&gt;

&lt;p&gt;The native methods trade a little configuration for a large cut in memory while your ingestion stays exactly as it was. Scalar quantization at 16 bits halves memory at recall close to full precision, and the 2- and 4-bit settings take you to 16x and 8x. At the 32x end, you set the compression level and the optimized scalar quantizer takes over on either engine, recovering recall with corrective factors, asymmetric distance computation, and random rotation that you never configure. Product quantization serves the largest corpora, and oversampling tunes recall across all of them. When your queries filter down to a small set, exact k-NN sidesteps the graph cost altogether.&lt;/p&gt;

&lt;p&gt;The next article moves from compressing the vectors to moving them off memory. On-disk mode keeps a compressed graph in RAM and the full-precision vectors on disk, with a two-phase search that rescores against those full-precision vectors, and cost-stacking techniques layer on top of any method here for more savings.&lt;/p&gt;

</description>
      <category>vectorsearch</category>
      <category>airetrieval</category>
      <category>opensearch</category>
      <category>quantization</category>
    </item>
  </channel>
</rss>
