Skip to content

Commit e8eb847

Browse files
authored
Refactor manual proto ResponseItem (opensearch-project#160)
1 parent 35a9fea commit e8eb847

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
99
- Align manual proto with generated proto - search ([#154](https://github.com/opensearch-project/opensearch-protobufs/pull/154))
1010
- Update preprocessing - convert oneof const to enum ([#157](https://github.com/opensearch-project/opensearch-protobufs/pull/157))
1111
- Align manual proto with generated proto - enums ([#158](https://github.com/opensearch-project/opensearch-protobufs/pull/158))
12-
12+
- Refactor manual proto ResponseItem ([#160](https://github.com/opensearch-project/opensearch-protobufs/pull/160))
1313
### Removed
1414

1515
### Fixed

protos/schemas/document.proto

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,23 @@ message BulkResponseBody {
211211
// [optional] If true, one or more of the operations in the bulk request did not complete successfully.
212212
optional bool errors = 1;
213213
// [optional] Contains the result of each operation in the bulk request, in the order they were submitted.
214-
repeated ResponseItem items = 2;
214+
repeated Item items = 2;
215215
// [optional] How long, in milliseconds, it took to process the bulk request.
216216
optional int64 took = 3;
217217
// [optional] How long, in milliseconds, it took to process documents through an ingest pipeline
218218
optional int64 ingest_took = 4;
219219

220220
}
221221

222+
message Item {
223+
oneof item {
224+
ResponseItem create = 1;
225+
ResponseItem delete = 2;
226+
ResponseItem index = 3;
227+
ResponseItem update = 4;
228+
}
229+
}
230+
222231
enum ResponseOpType {
223232
RESPONSE_OP_TYPE_CREATE = 0;
224233
RESPONSE_OP_TYPE_INDEX = 1;
@@ -227,37 +236,35 @@ enum ResponseOpType {
227236
}
228237

229238
message ResponseItem {
230-
// [required] the value are "create", "update", "index" and "delete"
231-
ResponseOpType response_op_type = 1;
232239
// [required] Name of the index associated with the operation. If the operation targeted a data stream, this is the backing index into which the document was written.
233-
string underscore_index = 2;
240+
string underscore_index = 1;
234241
// [required] HTTP status code returned for the operation.
235242
// TODO: use grpc status code instead
236-
int32 status = 3;
243+
int32 status = 2;
237244
// [optional] The document type.
238-
optional string underscore_type = 4;
245+
optional string underscore_type = 3;
239246

240247
// [optional] The document ID associated with the operation.
241-
optional Id underscore_id = 5;
248+
optional Id underscore_id = 4;
242249

243250
// [optional] Contains additional information about the failed operation.
244-
optional ErrorCause error = 6;
251+
optional ErrorCause error = 5;
245252

246253
// [optional] The primary term assigned to the document for the operation.
247-
optional int64 underscore_primary_term = 7;
254+
optional int64 underscore_primary_term = 6;
248255

249256
// [optional] Result of the operation. Successful values are `created`, `deleted`, and `updated`.
250-
optional string result = 8;
257+
optional string result = 7;
251258
// [optional] The sequence number assigned to the document for the operation. Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version
252-
optional int64 underscore_seq_no = 9;
259+
optional int64 underscore_seq_no = 8;
253260
// [optional] Contains shard information for the operation. This parameter is only returned for successful operations.
254-
optional ShardInfo underscore_shards = 10;
261+
optional ShardInfo underscore_shards = 9;
255262
// [optional] The document version associated with the operation. The document version is incremented each time the document is updated. This parameter is only returned for successful actions.
256-
optional int64 underscore_version = 11;
263+
optional int64 underscore_version = 10;
257264
// [optional] if `true`, it requires immediate visibility of the document
258-
optional bool forced_refresh = 12;
265+
optional bool forced_refresh = 11;
259266
// [optional]
260-
optional InlineGetDictUserDefined get = 13;
267+
optional InlineGetDictUserDefined get = 12;
261268
}
262269

263270

0 commit comments

Comments
 (0)