Home > front end >  Why is ElasticSearch index searchable when refresh_interval is set to -1 on initial data upload?
Why is ElasticSearch index searchable when refresh_interval is set to -1 on initial data upload?

Time:10-06

I'm performing a large upload of data to an empty index.

This article suggests to set "refresh_interval=-1" and "number_of_replicas=0" to increase upload performance. Then it says to enable it back.

The interesting thing is that if I don't enable it back - I can still send the queries to the newly created index and get the results.

I'd like to know why is that and what I got wrong ? (My expectation was that I should get zero results because indexing is disabled)

And one more thing I'd like to understand - if I enable refresh_interval back to the original value, do I need to execute /_refresh operation ?

CodePudding user response:

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. You can change this default interval using the index.refresh_interval setting.

so document says: when you send a search request, it will send a refresh request with that. so you could search your data but very slow for first time or miss some data for first search. it is better to have a refresh_interval if you index new data on your indices.

  • Related