Skip to content

[FEATURE] Align Put, Update, and Delete request objects with OpenSearch DocWriteRequest interface #233

@dbwiddis

Description

@dbwiddis

Is your feature request related to a problem?

Currently, there's an inconsistency between this repo's request objects and OpenSearch's native request objects. Specifically, the PutDataObjectRequest and DeleteDataObjectRequest lack support for sequence numbers and primary terms, which are fields present in OpenSearch's DocWriteRequest, implemented by the IndexRequest and DeleteRequest classes, respectively. This inconsistency affects the concurrency mechanism in the OpenSearch specific store, as it cannot properly verify document modifications using sequence numbers and primary terms for put (index, when overwriting) and delete operations.

What solution would you like?

Align the SDK's request objects (PutDataObjectRequest, UpdateDataObjectRequest, and DeleteDataObjectRequest) with their OpenSearch counterparts by:

  • Moving ifSeqNo and ifPrimaryTerm fields to the base DataObjectRequest class
  • Ensuring all write operations (Put, Update, Delete) inherit these fields consistently
  • Updating corresponding client implementations to leverage this common code structure (centralize the seqNo/primaryTerm code)

What alternatives have you considered?

  • Keeping the current structure but adding the fields individually to the Put and Delete request types
  • Creating a new interface similar to DocWriteRequest specifically for the SDK

Aligning with OpenSearch's existing patterns provides the most consistent and maintainable solution.

Do you have any additional context?

Related to issue #136

The UpdateDataObjectRequest already implements these fields and its code can be refactored for re-use with the other request objects in their respective clients.

The change would also benefit BulkRequest implementations which use DataObjectRequest as their base type

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions