CLOUD & DEVOPS
Elasticsearch에서 컨텍스트 구축: AI 인덱스가 더 적은 토큰으로 스마트 에이전트를 강화하는 방법

Store AI agent context in an AI Index and power smarter agents using fewer tokens. Step-by-step walkthrough with ES|QL and Kibana Workflows included. Agents burn tokens exploring your data before they answer anything, inspecting mappings, sampling documents, probing which index to use. Elasticsearch AI Indices let you precompute that work once and store it as a Knowledge Indicator (KI): a structured, searchable record agents retrieve directly instead of rediscovering from scratch.
This walkthrough shows you how to build the full pipeline: create an AI Index, generate routing KIs with a Kibana Workflow, and wire them to any agent harness via a portable ES|QL skill. We've also provided a notebook if you'd like to run it yourself end to end as you go through the examples in this blog. This is Part 1 in a blog series providing a technical walkthrough to managing your context through KIs and AI indices. While AI indices will be included in future Stack releases, today we recommend using Serverless. Building context in this walkthrough has three moving parts: An AI Index , where KIs live.
It's a regular Elasticsearch index or data stream with a specific naming convention triggering component templates to configure the right mappings automatically. Kibana Workflows , which read from your data sources, run an LLM to structure content into KIs, and write those KIs into the AI Index. A query-ki skill , a skill that queries KIs directly from the AI Index using ES|QL, and that a chat agent can call as a tool. First, we’ll need some sources. Sources can be data that already exists in your Elasticsearch indices, or external data accessed via connectors or ES|QL data sources.
For this blog, we’ll create some indices with example data. We’ll start with an example using three datasets: BEIR/fiqa (financial), beir-nfcorpus (biomedical/nutrition), and beir-scifact (scientific fact-checking). Each index is populated with its own _meta. Then, using the above convenience scripts, load a handful of documents into each index with the _bulk API. Now imagine an agent with a question and the indices we’ve just created. The agent has no idea which one is relevant at the start.