To refresh or not to refresh

(Stefan) #1

Hi all,

I am quite new to ElasticSearch and currently in the process of reading the docs and playing with it in parallel.

I have a question to an (inconsistent?) part of the documentation:

The "Realtime" section states that a GET will implicitly execute a refresh before returning the data (except when disabled with ?realtime=false).

The "Refresh" section down on the same page states that I can use ?refresh=true to enforce a refresh before the GET is actually executed, but I should use this with care because of performance reasons.

Those two sections seem contradicting. What is the default - to refresh or not to refresh? Or maybe I misunderstood something?

Thanks and regards

(Nhat Nguyen) #2

Technically there are two kinds of refresh: INTERNAL and EXTERNAL. An INTERNAL refresh is much faster and cheaper than an EXTERNAL. If the realTime=true , the GET API might issue an INTERNAL refresh if needed; and if refresh=true, the GET API might issue an EXTERNAL refresh.

Default values: refresh=false, realTime=true.

(David Pilato) #3

Great @nhat. So I'm wondering why we are actually documenting a slow option when we have a fast option. Shouldn't we only document realtime?

(Stefan) #4

Thanks. Seems I can live with the defaults, although I am still a bit confused about the differences about an "internal" vs "external" refresh. If the internal refresh is so much faster - why not ALWAYS use this kind of refresh? :wink:

(Nhat Nguyen) #5

The EXTERNAL refresh is more expensive than the INTERNAL because of caching and warming up. The GET requests don't really need caching or warming, while the search requests need them. That's why we have two kinds of the refresh.

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.