A refresh interval is the time Elasticsearch waits between refresh operations that make newly indexed documents searchable. The default interval is one second, but longer intervals can reduce repeated disk I/O during heavy indexing. section 5.1.2 section 15.2.3
Choose the setting according to how quickly new documents must appear in search:
- Set refresh_interval to 60s or 1m when indexing can tolerate a one-minute delay; documents indexed during that period are not immediately searchable. section 5.1.3 section 15.2.3
- Set refresh_interval to -1 before a large migration or bulk load to disable automatic refresh and reduce resource-intensive disk I/O. section 15.2.3
- Restore the interval afterward, or call POST <index>/_refresh, so indexed documents become available for searching. section 5.1.3 section 15.2.3
Bulk-loading a movie index
Set a longer interval while loading many movie documents, then restore normal refreshing when the load finishes. For individual writes, refresh=false uses the interval; refresh=true makes the document searchable immediately; refresh=wait_for blocks until a refresh completes. section 5.1.3 section 15.2.3
Listing 5.7 Setting a custom refresh interval
PUT movies/_settings
{
"index":{
"refresh_interval":"60s"
}
}
Inspect the REST request for setting a 60-second refresh interval on the movies index. section 5.1.3
