Nag
Nag

Reputation: 2057

elasticsearch - refresh interval of one second

I am aware of how refresh works and refresh happens every second by default. However, what disconnects me more here is

  1. Does it mean any size of data will appear in search after exactly one second or it means it will take at least one second for the searcher to see the new documents .
  2. From Documentation, "The default refresh interval is one second for indices that receive or more search requests in the last 30 seconds." It doesnt seem apply for all the indices, can someone shed more details about this what it really mean by for indices that receive or more search requests in the last 30 seconds in the context of what happens to other indices which didnt receive the search req in last 30 sec

Upvotes: 2

Views: 1342

Answers (1)

Amit
Amit

Reputation: 32386

Really nice question, let me try to explain to you.

1. Does it mean any size of data will appear in search after exactly one second or it means it will take at least one second for the searcher to see the new documents.

Answer: Size of data has got nothing to do here, it's simply a background process in elasticsearch which commits data from im-memory(which is not available to searches) to segments(Hope you know what segments in ES and Lucene), so that it's available for searches.

2.The default refresh interval is one second for indices that receive or more search requests in the last 30 seconds.

Answer: This is the smart optimization done by elasticsearch to reduce the overhead of refresh(explained earlier), if your indices didn't get any search request in last 30 seconds, so no need to explicit refresh(as only when you search, you will get to see the latest data, available by using refresh), Hence on indices which have not got any search requests in last 30 seconds, ES can skip the refresh on those indices, even their refresh interval is 1 second.

Upvotes: 3

Related Questions