Refresh interval on indices with no changes

If I explicitly set a refresh_interval on an index, will it still run the refresh operation, even if no new documents have been indexed to it since the last refresh?

I'm trying to understand if setting an explicit refresh interval ends up being more costly, because it disables the automatic idle-functionality that I know happens if no searches are being made as described here. I wonder if thats the case for index operations as well.

If it does the refresh in any case when explicity set, are refreshes on an index that hasn't changed expensive or near zero cost?

Possibly linking to the source code as well would be extremely helpful. I haven't been able to find the code responsible for this.

Thanks!

Refresh interval is set by default and will only run if there are new additions or changes to be published so there is no overhead. The part you mention described how the shard can postpone refreshing (which can be an expensive operation) for shards that are not searched. If you have nothing changing in the index it does not apply.

Thanks, that answers my question!

Maybe that would be helpful in the documentation as well. Right now it only talks about how indices that are not being searched, will not need to refresh.