opensearch-project / opensearch-project/opensearch-java

[FEATURE] Add translog.retention.size to high-level IndexSettings builder

Open
#1,722 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

Is your feature request related to a problem?

When configuring index settings using the high-level opensearch-java client, it's not possible to set the index.translog.retention.size using the strongly-typed IndexSettings.Builder.

While other translog settings like flushThresholdSize are available via Translog.Builder, the retention settings are missing. This forces developers to drop down to the low-level RestClient to perform a raw API call to configure this important setting, which is inconvenient and bypasses the type-safety benefits of the high-level client.

What solution would you like?

The IndexSettings.Builder or, more appropriately, the nested Translog.Builder should be enhanced to include methods for translog retention settings.

A clear and consistent implementation would be to add methods like .retentionSize() and .retentionAge() within the .translog() builder lambda.

Example of desired usage:

IndexSettings settings = new IndexSettings.Builder()
    // ... other settings
    .translog(t -> t
        .flushThresholdSize("100mb")
        // Proposed new method
        .retentionSize("512mb") 
    )
    .build();
What alternatives have you considered?

The only current alternative is to create the index with the high-level client and then perform a second, separate API call using the low-level RestClient to update the settings with the missing translog.retention.size parameter. This is cumbersome, requires extra code, and is not an intuitive workflow.

Do you have any additional context?

Adding this capability would improve the feature parity of the high-level client with the OpenSearch API and provide a more complete and convenient developer experience for managing index settings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the high-level IndexSettings.Builder and its nested Translog.Builder, then inspect the existing flushThresholdSize method and how index settings map to OpenSearch API parameters. Add the requested translog retention configuration and verify that the builder can produce settings for translog.retention.size without requiring the low-level RestClient.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.