@@ -20,13 +20,15 @@ import (
20
20
// for details.
21
21
type BulkDeleteRequest struct {
22
22
BulkableRequest
23
- index string
24
- typ string
25
- id string
26
- parent string
27
- routing string
28
- version int64 // default is MATCH_ANY
29
- versionType string // default is "internal"
23
+ index string
24
+ typ string
25
+ id string
26
+ parent string
27
+ routing string
28
+ version int64 // default is MATCH_ANY
29
+ versionType string // default is "internal"
30
+ ifSeqNo * int64
31
+ ifPrimaryTerm * int64
30
32
31
33
source []string
32
34
@@ -38,13 +40,15 @@ type bulkDeleteRequestCommand map[string]bulkDeleteRequestCommandOp
38
40
39
41
//easyjson:json
40
42
type bulkDeleteRequestCommandOp struct {
41
- Index string `json:"_index,omitempty"`
42
- Type string `json:"_type,omitempty"`
43
- Id string `json:"_id,omitempty"`
44
- Parent string `json:"parent,omitempty"`
45
- Routing string `json:"routing,omitempty"`
46
- Version int64 `json:"version,omitempty"`
47
- VersionType string `json:"version_type,omitempty"`
43
+ Index string `json:"_index,omitempty"`
44
+ Type string `json:"_type,omitempty"`
45
+ Id string `json:"_id,omitempty"`
46
+ Parent string `json:"parent,omitempty"`
47
+ Routing string `json:"routing,omitempty"`
48
+ Version int64 `json:"version,omitempty"`
49
+ VersionType string `json:"version_type,omitempty"`
50
+ IfSeqNo * int64 `json:"if_seq_no,omitempty"`
51
+ IfPrimaryTerm * int64 `json:"if_primary_term,omitempty"`
48
52
}
49
53
50
54
// NewBulkDeleteRequest returns a new BulkDeleteRequest.
@@ -116,6 +120,20 @@ func (r *BulkDeleteRequest) VersionType(versionType string) *BulkDeleteRequest {
116
120
return r
117
121
}
118
122
123
+ // IfSeqNo indicates to only perform the delete operation if the last
124
+ // operation that has changed the document has the specified sequence number.
125
+ func (r * BulkDeleteRequest ) IfSeqNo (ifSeqNo int64 ) * BulkDeleteRequest {
126
+ r .ifSeqNo = & ifSeqNo
127
+ return r
128
+ }
129
+
130
+ // IfPrimaryTerm indicates to only perform the delete operation if the
131
+ // last operation that has changed the document has the specified primary term.
132
+ func (r * BulkDeleteRequest ) IfPrimaryTerm (ifPrimaryTerm int64 ) * BulkDeleteRequest {
133
+ r .ifPrimaryTerm = & ifPrimaryTerm
134
+ return r
135
+ }
136
+
119
137
// String returns the on-wire representation of the delete request,
120
138
// concatenated as a single string.
121
139
func (r * BulkDeleteRequest ) String () string {
@@ -136,13 +154,15 @@ func (r *BulkDeleteRequest) Source() ([]string, error) {
136
154
}
137
155
command := bulkDeleteRequestCommand {
138
156
"delete" : bulkDeleteRequestCommandOp {
139
- Index : r .index ,
140
- Type : r .typ ,
141
- Id : r .id ,
142
- Routing : r .routing ,
143
- Parent : r .parent ,
144
- Version : r .version ,
145
- VersionType : r .versionType ,
157
+ Index : r .index ,
158
+ Type : r .typ ,
159
+ Id : r .id ,
160
+ Routing : r .routing ,
161
+ Parent : r .parent ,
162
+ Version : r .version ,
163
+ VersionType : r .versionType ,
164
+ IfSeqNo : r .ifSeqNo ,
165
+ IfPrimaryTerm : r .ifPrimaryTerm ,
146
166
},
147
167
}
148
168
0 commit comments