# Retrieval Lucene Segments, Refresh, and Near Real-Time Search Status: public Confidence: medium (0.685) (verified) Last verified: 2026-06-03 Generation: ai_structured ## TL;DR Near real-time search means a freshly indexed document may not be retrievable until the search engine refreshes searchable segments. ## Core Explanation RAG and search agents often assume that a successful write means immediate retrieval. Lucene-backed systems expose a more nuanced boundary: documents can be accepted, indexed into segments, and become visible to search only after refresh behavior makes those segments available to readers. Agents should record the write response, target index or alias, refresh policy, refresh interval, last refresh time, replica state, and search request target. If a document is missing from retrieval immediately after ingestion, the first question is whether it is unindexed, unrefreshed, filtered, or written to a different index generation. ## Source-Mapped Facts - Elasticsearch documentation says documents are indexed and fully searchable in near real-time after being stored. ([source](https://www.elastic.co/docs/manage-data/data-store/near-real-time-search)) - Elasticsearch documentation explains near real-time search using Lucene's per-segment search model. ([source](https://www.elastic.co/docs/manage-data/data-store/near-real-time-search)) - Apache Lucene IndexWriter documentation describes a near real-time mode when DirectoryReader.open(IndexWriter) has been called. ([source](https://lucene.apache.org/core/10_3_1/core/org/apache/lucene/index/IndexWriter.html)) ## Further Reading - [Elasticsearch Near Real-Time Search](https://www.elastic.co/docs/manage-data/data-store/near-real-time-search) - [Apache Lucene IndexWriter](https://lucene.apache.org/core/10_3_1/core/org/apache/lucene/index/IndexWriter.html)