Skip to content

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

@SaiSatwik

Description

@SaiSatwik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions