0
0
Elasticsearchquery~10 mins

Index refresh interval in Elasticsearch - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Index refresh interval
Index receives new data
Data stored in memory (translog)
Wait for refresh interval timer
Refresh triggered
In-memory data made searchable
New data visible in search results
Wait for next refresh interval
New data is first stored in memory, then after the refresh interval, it becomes searchable.
Execution Sample
Elasticsearch
PUT /my_index/_settings
{
  "index.refresh_interval": "5s"
}
Sets the index refresh interval to 5 seconds, controlling how often new data becomes searchable.
Execution Table
StepActionRefresh Interval TimerData StateSearch Visibility
1Index receives new documentTimer startsData in memory (not searchable)No
2Wait 3 secondsTimer counting down (2s left)Data still in memoryNo
3Wait 2 more secondsTimer reaches 0Data refreshedYes
4New data visible in searchTimer resets to 5sData searchableYes
5Index receives another documentTimer runningNew data in memoryNo
6Wait 5 secondsTimer reaches 0Data refreshedYes
7New data visible in searchTimer resetsData searchableYes
8StopN/AN/AN/A
💡 Process repeats every refresh interval; stops here for demonstration.
Variable Tracker
VariableStartAfter Step 1After Step 3After Step 5After Step 6Final
Refresh Interval Timer5s5s (started)0s (refresh triggered)5s (started again)0s (refresh triggered)5s (ready for next)
Data StateNo dataIn memory (not searchable)Refreshed (searchable)In memory (new data)Refreshed (searchable)Searchable
Search VisibilityNoNoYesNoYesYes
Key Moments - 3 Insights
Why is new data not immediately searchable after indexing?
Because data is first stored in memory and only becomes searchable after the refresh interval timer reaches zero, as shown in execution_table rows 1 and 3.
What happens when the refresh interval timer reaches zero?
The in-memory data is refreshed and made searchable, as seen in execution_table row 3 where Search Visibility changes from No to Yes.
Does the refresh interval timer reset after each refresh?
Yes, the timer resets to the configured interval after each refresh, shown in execution_table rows 4 and 7.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the data become searchable for the first time?
AStep 1
BStep 5
CStep 3
DStep 6
💡 Hint
Check the 'Search Visibility' column in execution_table rows.
According to variable_tracker, what is the value of the Refresh Interval Timer after Step 5?
A5s
B0s
C3s
DN/A
💡 Hint
Look at the 'Refresh Interval Timer' row in variable_tracker after Step 5.
If the refresh interval is set to 10s instead of 5s, how would the timer values change in the execution_table?
ATimer would count down from 5s as before
BTimer would count down from 10s instead of 5s
CTimer would reset to 0s immediately
DTimer would stop running
💡 Hint
Consider the meaning of the refresh interval setting shown in execution_sample.
Concept Snapshot
Index refresh interval controls how often Elasticsearch makes new data searchable.
Data is first stored in memory, then refreshed at intervals (default 1s).
Setting a longer interval reduces overhead but delays search visibility.
Use PUT /index/_settings with "index.refresh_interval" to change it.
Example: "index.refresh_interval": "5s" means refresh every 5 seconds.
Full Transcript
The index refresh interval in Elasticsearch determines how often new data becomes visible in search results. When data is indexed, it is first stored in memory and not immediately searchable. A timer counts down the refresh interval, and when it reaches zero, Elasticsearch refreshes the index, making the new data searchable. This process repeats continuously. Setting a longer refresh interval reduces system load but delays when new data appears in searches. You can change the refresh interval using the index settings API, for example setting it to 5 seconds. The execution table shows the timer counting down and data state changes step by step, while the variable tracker records the timer and data visibility states. Key moments clarify why data isn't searchable immediately and how the timer resets after each refresh. The visual quiz tests understanding of these steps and timer behavior.