Java API client : How to reset index settings value

For performance reasons, I need to temporarily disable refresh_interval at index settings level while bulk loading takes place in the index, and enable it back afterwards.
The refresh_interval value is held by global cluster settings and set at 1s.

I managed to set an index setting value with Java API Client :

        new PutIndicesSettingsRequest.Builder()
                        new IndexSettings.Builder()
                                .refreshInterval(new Time.Builder().time("-1").build())

After bulk loading, I need to revert this, i.e. remove the refresh_interval entry from my index settings.
Looking at the REST API documentation, resetting an index setting value is done by PUTting a null value for it.

PUT /my-index-000001/_settings
  "index" : {
    "refresh_interval" : null

As I understand, once the setting is null at index level, the index will inherit the default setting value from the global settings again.
Unfortunately, doing so with the Java API Client didn't work :

        new PutIndicesSettingsRequest.Builder()
                .settings(new IndexSettings.Builder()

I get this error at runtime :

co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/indices.put_settings] failed: [action_request_validation_exception] Validation Failed: 1: no settings to update;
  at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(
  at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(
  at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.putSettings(

Is there a way to reset an index setting by setting it to null using the java API client ?

@swallez could you look at this? Is there a way to do it?

This is currently not supported. I opened Allow sending the `null` value where it has a specific meaning · Issue #549 · elastic/elasticsearch-java · GitHub for this.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.