Elasticsearch Refresh



Elasticsearch Refresh

Opster Team

July 2020, Version: 1.7-8.0


Before you begin reading the explanation below, try running the free ES Health Check-Up get actionable recommendations that can improve Elasticsearch performance and prevent serious incidents. Just 2 minutes to complete and you can check your threadpools, memory, snapshots and many more

Refresh in Elasticsearch


What it is

When indexing data, Elasticsearch requires a “refresh” operation to make indexed information available for search. This means that there is a time delay between indexing and the updated information actually becoming available for the client applications.

How it works

Index operations occur in memory. The operations are accumulated in a buffer until refreshed, which requires that the buffer be transferred to a newly created lucene segment. Refresh happens by default every second, but it is also possible to change this frequency for a given index, or directly request a refresh through the refresh api.

Examples

You can set the refresh interval on an index like this:

PUT /my_index/_settings
{
    "index" : {
        "refresh_interval" : "30s"
    }
}

You can use a value of -1 to represent “no refresh” but remember to set it back once you’ve finished indexing!

You can force a refresh on a given index like this:

POST my_index/_refresh

You can also force a refresh at the end of an index operation by adding an extra parameter in the url like this:

POST /my_index/_index?refresh=waitfor

In this case, the “waitfor” parameter will force the client to wait for the refresh to complete before returning (useful in scripts), or you can use “true” to force the refresh without keeping the script waiting.

Notes and good things to know:

Refreshing is resource-intensive, so you can increase indexing speed by reducing the refresh rate. You can do this temporarily if you need to reload a lot of data, or for some logging applications it is perfectly acceptable to have, say, a 30s latency before data actually becomes available.

Beware of the refresh interval when scripting or updating. Scripts often work faster than the refresh interval, so if necessary, you might need to call a refresh before retrieving or updating data in your scripts, or use the waitfor parameter while indexing as described above.


Related log errors to this ES concept


Failed to find token for refresh token after attempts
Failed to perform engine refresh
Failed to refresh token for doc after attempts
Failed to refresh job memory requirements
Could not find token document for refresh
Security index does not exist therefore refresh token cannot be validated
Error firing refresh listener
Falling back to allocating job by job counts because a memory requirement refresh could not be scheduled
Cant send mapping refresh for ; no master known.
Failed to perform scheduled engine refresh
Failed to refresh after decreasing index buffer
Failed to refresh settings for

< Page: 1 of 3 >


About Opster

Opster detects, prevents, optimizes and automates everything needed to run mission-critical Elasticsearch

Find Configuration Errors

Analyze Now