diff --git a/opensearchutil/bulk_indexer.go b/opensearchutil/bulk_indexer.go index 3f08cec11..f56ceaca8 100644 --- a/opensearchutil/bulk_indexer.go +++ b/opensearchutil/bulk_indexer.go @@ -133,7 +133,7 @@ type bulkActionMetadata struct { Routing *string `json:"routing,omitempty"` Version *int64 `json:"version,omitempty"` VersionType *string `json:"version_type,omitempty"` - IfSeqNum *int64 `json:"if_seq_num,omitempty"` + IfSeqNum *int64 `json:"if_seq_no,omitempty"` IfPrimaryTerm *int64 `json:"if_primary_term,omitempty"` WaitForActiveShards interface{} `json:"wait_for_active_shards,omitempty"` Refresh *string `json:"refresh,omitempty"` diff --git a/opensearchutil/bulk_indexer_internal_test.go b/opensearchutil/bulk_indexer_internal_test.go index a5c909ba7..ff8539d64 100644 --- a/opensearchutil/bulk_indexer_internal_test.go +++ b/opensearchutil/bulk_indexer_internal_test.go @@ -678,7 +678,18 @@ func TestBulkIndexer(t *testing.T) { `{"index":{"_index":"test","_id":"42"}}` + "\n", }, { - "with version and no document", + "with if_seq_no and if_primary_term", + args{BulkIndexerItem{ + Action: "index", + DocumentID: "42", + Index: "test", + IfSeqNum: int64Pointer(5), + IfPrimaryTerm: int64Pointer(1), + }}, + `{"index":{"_index":"test","_id":"42","if_seq_no":5,"if_primary_term":1}}` + "\n", + }, + { + "with version and no document, if_seq_no, and if_primary_term", args{BulkIndexerItem{ Action: "index", Index: "test",