# Elasticsearch 8. Refresh API

**URL:** <https://discuss.elastic.co/t/elasticsearch-8-refresh-api/378782>\
**Category:** Elasticsearch\
**Created:** [June 2, 2025, 7:47am UTC](https://discuss.elastic.co/t/elasticsearch-8-refresh-api/378782 "2025-06-02T07:47:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s_r/32/123391_2.png) [@S\_R](https://discuss.elastic.co/u/S_R)\
**Post date:** [June 2, 2025, 7:47am UTC](https://discuss.elastic.co/t/elasticsearch-8-refresh-api/378782/1 "2025-06-02T07:47:19Z")

</div>

Hi,  
I'm facing an probable issue in ES 8.x.x where the refresh operation has become significantly slower compared to versions 7.x.x ≤ 7.17.  
In our setup, each index is created with ` "refresh_interval": "30s"`. In version 7.x.x, even with more than 1000 indices, there was no noticeable delay (according to QA).

We recently conducted a test with ES 8:

- Created an index in ES 8
- Checked for the index — it wasn't visible (as expected due to the refresh\_interval: 30s) Time: 2025-05-30T09:29:55.516Z
- Called `/refresh` on ES 8
- Checked it again right after — index was still not visible Time: 2025-05-30T09:29:57.308Z

**Cluster configuration (ES 8):**

```auto
_nodes":{
      "total":2,
      "successful":2,
      "failed":0
   }
"status":"yellow",
   "indices":{
      "count":679,
      "shards":{
         "total":679,
         "primaries":679,
         "replication":0.0,
         "index":{
            "shards":{
               "min":1,
               "max":1,
               "avg":1.0
            },
            "primaries":{
               "min":1,
               "max":1,
               "avg":1.0
            },
            "replication":{
               "min":0.0,
               "max":0.0,
               "avg":0.0
            }
         }
      }

"nodes":{
      "count":{
         "total":2,
         "coordinating_only":0,
         "data":1,
         "data_cold":0,
         "data_content":0,
         "data_frozen":0,
         "data_hot":0,
         "data_warm":0,
         "index":0,
         "ingest":1,
         "master":1,
         "ml":0,
         "remote_cluster_client":0,
         "search":0,
         "transform":1,
         "voting_only":0
      },
      "versions":[
         "8.17.4"
      ]

"os":{
         "available_processors":8,
         "allocated_processors":8,
         "names":[
            {
               "name":"Linux",
               "count":2
            }
         ],
         "pretty_names":[
            {
               "pretty_name":"Ubuntu 20.04.6 LTS",
               "count":2
            }
         ],
         "architectures":[
            {
               "arch":"amd64",
               "count":2
            }
         ],
         "mem":{
            "total_in_bytes":4294967296,
            "adjusted_total_in_bytes":4294967296,
            "free_in_bytes":504348672,
            "used_in_bytes":3790618624,
            "free_percent":12,
            "used_percent":88
         }
      },
      "process":{
         "cpu":{
            "percent":0
         },
         "open_file_descriptors":{
            "min":608,
            "max":2628,
            "avg":1618
         }
      },
      "jvm":{
         "max_uptime_in_millis":237910025,
         "versions":[
            {
               "version":"23",
               "vm_name":"OpenJDK 64-Bit Server VM",
               "vm_version":"23+37-2369",
               "vm_vendor":"Oracle Corporation",
               "bundled_jdk":true,
               "using_bundled_jdk":true,
               "count":2
            }
         ],
         "mem":{
            "heap_used_in_bytes":1009469104,
            "heap_max_in_bytes":2361393152
         },
         "threads":131
      },
      "fs":{
         "total_in_bytes":59814944768,
         "free_in_bytes":59330650112,
         "available_in_bytes":59297095680
      },

```

It seems like something changed between ES 7 and ES 8 that is affecting refresh behavior.

Maybe the best course of action is either to add more data nodes to handle the load or do nothing - it is just a standart behaviour.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 2, 2025, 8:14am UTC](https://discuss.elastic.co/t/elasticsearch-8-refresh-api/378782/2 "2025-06-02T08:14:41Z")

</div>

> [@S\_R](#):
>
> Checked for the index — it wasn't visible (as expected due to the refresh\_interval: 30s)

Did the index not exist or did it not show any data? How was it created? Which command did you use to check?

> [@S\_R](#):
>
> Called `/refresh` on ES 8

A refresh makes indexed documents serachable but does not have anthing to do with indices being created, so I am a bit confused about your statement.

---

<div class="post-metadata">

**Author:** ![S\_R](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s_r/32/123391_2.png) [@S\_R](https://discuss.elastic.co/u/S_R)\
**Post date:** [June 2, 2025, 9:02am UTC](https://discuss.elastic.co/t/elasticsearch-8-refresh-api/378782/3 "2025-06-02T09:02:19Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> Did the index not exist or did it not show any data? How was it created? Which command did you use to check?

_With the help of co.elastic.clients.elasticsearch.indices_

```auto
try {
            CreateIndexRequest.Builder createIndexBuilder = new Builder();
            createIndexBuilder.index(index);
            createIndexBuilder.settings(settings != null ? settings : getDefaultIndexSettings());

            if (mapping != null) {
                Map<String, Map<String, Object>> mappings = Map.of("mappings", mapping);
                String mappingJson = objectMapper.writeValueAsString(mappings);
                createIndexBuilder.withJson(new ByteArrayInputStream(mappingJson.getBytes()));
            }
            createIndexBuilder.timeout(REQUEST_TIMEOUT);
            long startTime = System.currentTimeMillis();

            CreateIndexResponse createIndexResponse = client.indices().create(createIndexBuilder.build());
            long stopTime = System.currentTimeMillis();
            // cache the index status
            boolean indexStatus = createIndexResponse.acknowledged() && createIndexResponse.shardsAcknowledged();

..........

 private IndexSettings getDefaultIndexSettings() {
        IndexSettings.Builder builder = new IndexSettings.Builder();
        builder.refreshInterval(Time.of(timeBuilder -> timeBuilder.time("30s")));
        builder.numberOfShards("1");
        builder.numberOfReplicas("1");
        if (customIndexAnalyzerSetting.isEnabled()) {
            IndexSettingsAnalysis analysis = getCustomAnalyzer();
            builder.analysis(analysis);
        }
        return builder.build();
    }

```

> [@Christian\_Dahlqvist](#):
>
> A refresh makes indexed documents serachable but does not have anthing to do with indices being created, so I am a bit confused about your statement.

`/our_index/_search?typed_keys=true&ignore_unavailable=true&expand_wildcards=open%2Cclosed&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true`

We created an index (`refresh-index=30s`) and some documents under it. However, even after calling `/refresh` the documents are not visible either, but after `10-15 sec`, there were visible through ES API.
