# Java REST Client - Refresh API and Default Refresh Index

**URL:** https://discuss.elastic.co/t/java-rest-client-refresh-api-and-default-refresh-index/378829
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [June 3, 2025, 3:48pm UTC](https://discuss.elastic.co/t/java-rest-client-refresh-api-and-default-refresh-index/378829 "2025-06-03T15:48:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![enerijunior](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enerijunior/32/143504_2.png) [@enerijunior](https://discuss.elastic.co/u/enerijunior)
#### Post date: [June 3, 2025, 3:48pm UTC](https://discuss.elastic.co/t/java-rest-client-refresh-api-and-default-refresh-index/378829/1 "2025-06-03T15:48:40Z")

</div>

Hello, everyone!

I have a question about using the Java REST Client - Refresh API or the default refresh behavior in an Elasticsearch index.

In a certain part of an application I'm maintaining, I have an implementation that calls refresh after each indexing operation using:

```java
RefreshResponse refreshResponse = client. Indices().refresh(request, RequestOptions.DEFAULT);

```

Doc: ([Refresh API | Java REST Client [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-refresh.html#java-rest-high-refresh-sync))

I need to make an adjustment here for performance reasons.

When reading the Elasticsearch documentation, I came across the following parameter:

`refresh_interval`

Doc: ([Refresh an index | Elasticsearch API documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-refresh-1)).

As I understand it, if this parameter is not explicitly set, Elasticsearch will perform a refresh operation every second on indexes that have received any requests in the last 30 seconds.

My question is: Do the two approaches serve the same purpose? In other words, is one an explicit API call on demand and the other the default automatic mechanism? If they are equivalent, I could reconsider my indexing approach and rely on the default update behavior instead of manually calling the API each time.

Thanks in advance for any insight!

---

<div class="post-metadata">

### Author: ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)
#### Post date: [July 11, 2025, 11:08am UTC](https://discuss.elastic.co/t/java-rest-client-refresh-api-and-default-refresh-index/378829/2 "2025-07-11T11:08:21Z")

</div>

Hello and welcome!

Your understanding is correct: calling the `refresh` api will trigger a manual, synchronous refresh operation, meaning the call won't return until refreshing is complete, while the automatic refresh mechanism will refresh, by default, every 1 second.

Here's the documentation for `index.refresh_interval` which explains more in depth how it works, from the [settings documentation](https://www.elastic.co/docs/reference/elasticsearch/index-settings/index-modules#dynamic-index-settings):

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/2/12a10b89ca83636185eb9a1b668cafea048f5a35.png)

How often you want to refresh depends on the nature of the application, for example if you need to ingest a very large amount of data, and you need all data to be correctly indexed and made available for search before performing an operation, then performing a manual refresh at the end of the indexing is the best way to make sure that all of the records are available.
