milvus.proto 12.5 KB
Newer Older
1 2 3
syntax = "proto3";
package milvus.proto.milvus;

X
Xiangyu Wang 已提交
4
option go_package = "github.com/milvus-io/milvus/internal/proto/milvuspb";
5 6

import "common.proto";
Y
yukun 已提交
7
import "schema.proto";
8

G
godchen 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
service MilvusService {
  rpc CreateCollection(CreateCollectionRequest) returns (common.Status) {}
  rpc DropCollection(DropCollectionRequest) returns (common.Status) {}
  rpc HasCollection(HasCollectionRequest) returns (BoolResponse) {}
  rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {}
  rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {}
  rpc DescribeCollection(DescribeCollectionRequest) returns (DescribeCollectionResponse) {}
  rpc GetCollectionStatistics(GetCollectionStatisticsRequest) returns (GetCollectionStatisticsResponse) {}
  rpc ShowCollections(ShowCollectionsRequest) returns (ShowCollectionsResponse) {}

  rpc CreatePartition(CreatePartitionRequest) returns (common.Status) {}
  rpc DropPartition(DropPartitionRequest) returns (common.Status) {}
  rpc HasPartition(HasPartitionRequest) returns (BoolResponse) {}
  rpc LoadPartitions(LoadPartitionsRequest) returns (common.Status) {}
  rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {}
  rpc GetPartitionStatistics(GetPartitionStatisticsRequest) returns (GetPartitionStatisticsResponse) {}
  rpc ShowPartitions(ShowPartitionsRequest) returns (ShowPartitionsResponse) {}

  rpc CreateIndex(CreateIndexRequest) returns (common.Status) {}
  rpc DescribeIndex(DescribeIndexRequest) returns (DescribeIndexResponse) {}
  rpc GetIndexState(GetIndexStateRequest) returns (GetIndexStateResponse) {}
30
  rpc GetIndexBuildProgress(GetIndexBuildProgressRequest) returns (GetIndexBuildProgressResponse) {}
G
godchen 已提交
31 32
  rpc DropIndex(DropIndexRequest) returns (common.Status) {}

33
  rpc Insert(InsertRequest) returns (MutationResult) {}
G
godchen 已提交
34
  rpc Search(SearchRequest) returns (SearchResults) {}
35
  rpc Retrieve(RetrieveRequest) returns (RetrieveResults) {}
36
  rpc Flush(FlushRequest) returns (FlushResponse) {}
X
Xiangyu Wang 已提交
37
  rpc Query(QueryRequest) returns (QueryResults) {}
38
  rpc CalcDistance(CalcDistanceRequest) returns (CalcDistanceResults) {}
G
godchen 已提交
39 40 41 42

  rpc GetPersistentSegmentInfo(GetPersistentSegmentInfoRequest) returns (GetPersistentSegmentInfoResponse) {}
  rpc GetQuerySegmentInfo(GetQuerySegmentInfoRequest) returns (GetQuerySegmentInfoResponse) {}

X
Xiangyu Wang 已提交
43 44
  rpc Dummy(DummyRequest) returns (DummyResponse) {}

G
godchen 已提交
45 46 47 48
  // TODO: remove
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
}

49
message CreateCollectionRequest {
Z
zhenshan.cao 已提交
50
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
51
  string db_name = 2;
Z
zhenshan.cao 已提交
52
  string collection_name = 3; // must
Y
yukun 已提交
53
  // `schema` is the serialized `schema.CollectionSchema`
Z
zhenshan.cao 已提交
54 55
  bytes schema = 4; // must
  int32 shards_num = 5; // must. Once set, no modification is allowed
56 57 58
}

message DropCollectionRequest {
Z
zhenshan.cao 已提交
59
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
60
  string db_name = 2;
Z
zhenshan.cao 已提交
61
  string collection_name = 3; // must
62 63 64
}

message HasCollectionRequest {
Z
zhenshan.cao 已提交
65
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
66
  string db_name = 2;
Z
zhenshan.cao 已提交
67
  string collection_name = 3; // must
N
neza2017 已提交
68
  uint64 time_stamp = 4;
69 70
}

Y
yukun 已提交
71 72 73 74 75
message BoolResponse {
  common.Status status = 1;
  bool value = 2;
}

Z
zhenshan.cao 已提交
76 77 78 79 80
message StringResponse {
  common.Status status = 1;
  string value = 2;
}

81
message DescribeCollectionRequest {
Z
zhenshan.cao 已提交
82
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
83
  string db_name = 2;
Z
zhenshan.cao 已提交
84
  string collection_name = 3; // must
N
neza2017 已提交
85
  int64 collectionID = 4;
N
neza2017 已提交
86
  uint64 time_stamp = 5;
87 88 89
}

message DescribeCollectionResponse {
Y
yukun 已提交
90 91
  common.Status status = 1;
  schema.CollectionSchema schema = 2;
92
  int64 collectionID = 3;
93 94
  repeated string virtual_channel_names = 4;
  repeated string physical_channel_names = 5;
95 96
  uint64 created_timestamp = 6; // hybrid timestamp
  uint64 created_utc_timestamp = 7; // physical timestamp
97 98 99
}

message LoadCollectionRequest {
Z
zhenshan.cao 已提交
100
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
101
  string db_name = 2;
Z
zhenshan.cao 已提交
102
  string collection_name = 3; // must
103 104 105
}

message ReleaseCollectionRequest {
Z
zhenshan.cao 已提交
106
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
107
  string db_name = 2;
Z
zhenshan.cao 已提交
108
  string collection_name = 3; // must
109 110
}

G
godchen 已提交
111
message GetCollectionStatisticsRequest {
Z
zhenshan.cao 已提交
112
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
113
  string db_name = 2;
Z
zhenshan.cao 已提交
114
  string collection_name = 3; // must
115 116
}

G
godchen 已提交
117
message GetCollectionStatisticsResponse {
Z
zhenshan.cao 已提交
118 119
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
120 121
}

122 123 124 125 126
enum ShowCollectionsType {
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
127
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
128
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
129
  string db_name = 2;
N
neza2017 已提交
130
  uint64 time_stamp = 3;
131
  ShowCollectionsType type = 4;
132 133
}

G
godchen 已提交
134
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
135 136
  common.Status status = 1;
  repeated string collection_names = 2;
137
  repeated int64 collection_ids = 3;
138 139
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
140 141 142
}

message CreatePartitionRequest {
Z
zhenshan.cao 已提交
143
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
144
  string db_name = 2;
Z
zhenshan.cao 已提交
145 146
  string collection_name = 3; // must
  string partition_name = 4; // must
147 148 149
}

message DropPartitionRequest {
Z
zhenshan.cao 已提交
150
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
151
  string db_name = 2;
Z
zhenshan.cao 已提交
152 153
  string collection_name = 3; // must
  string partition_name = 4; // must
154 155 156
}

message HasPartitionRequest {
Z
zhenshan.cao 已提交
157
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
158
  string db_name = 2;
Z
zhenshan.cao 已提交
159 160
  string collection_name = 3; // must
  string partition_name = 4; // must
161 162
}

G
godchen 已提交
163
message LoadPartitionsRequest {
Z
zhenshan.cao 已提交
164
  common.MsgBase base = 1; // must
165
  string db_name = 2;
Z
zhenshan.cao 已提交
166 167
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
168 169
}

G
godchen 已提交
170
message ReleasePartitionsRequest {
Z
zhenshan.cao 已提交
171
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
172
  string db_name = 2;
Z
zhenshan.cao 已提交
173 174
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
175 176
}

G
godchen 已提交
177
message GetPartitionStatisticsRequest {
Z
zhenshan.cao 已提交
178
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
179
  string db_name = 2;
Z
zhenshan.cao 已提交
180 181
  string collection_name = 3; // must
  string partition_name = 4; // must
182 183
}

G
godchen 已提交
184
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
185 186
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
187 188
}

G
godchen 已提交
189
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
190
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
191
  string db_name = 2;
Z
zhenshan.cao 已提交
192
  string collection_name = 3; // must
193
  int64 collectionID = 4;
194 195
}

G
godchen 已提交
196
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
197 198 199
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
200 201
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
202 203 204 205 206 207 208 209 210 211 212
}

message DescribeSegmentRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 segmentID = 3;
}

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
213
  int64 buildID = 3;
214
  bool enable_index = 4;
215 216
}

G
godchen 已提交
217
message ShowSegmentsRequest {
218 219 220 221 222
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
223
message ShowSegmentsResponse {
224 225 226
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
227 228

message CreateIndexRequest {
Z
zhenshan.cao 已提交
229
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
230
  string db_name = 2;
Z
zhenshan.cao 已提交
231 232 233
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
234 235 236
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
237
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
238
  string db_name = 2;
Z
zhenshan.cao 已提交
239
  string collection_name = 3; // must
240
  string field_name = 4;
Z
zhenshan.cao 已提交
241
  string index_name = 5; // No need to set up for now @2021.06.30
242 243 244 245
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
246
  int64 indexID = 2;
247
  repeated common.KeyValuePair params = 3;
248
  string field_name = 4;
249 250 251
}

message DescribeIndexResponse {
252 253 254 255
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

256
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
257
  common.MsgBase base = 1; // must
258
  string db_name = 2 ;
Z
zhenshan.cao 已提交
259
  string collection_name = 3; // must
260
  string field_name = 4;
Z
zhenshan.cao 已提交
261
  string index_name = 5; // must
262 263 264 265 266 267 268 269
}

message GetIndexBuildProgressResponse {
  common.Status status = 1;
  int64 indexed_rows = 2;
  int64 total_rows = 3;
}

G
godchen 已提交
270
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
271
  common.MsgBase base = 1; // must
272
  string db_name = 2 ;
Z
zhenshan.cao 已提交
273
  string collection_name = 3; // must
274
  string field_name = 4;
Z
zhenshan.cao 已提交
275
  string index_name = 5; // No need to set up for now @2021.06.30
276 277
}

G
godchen 已提交
278
message GetIndexStateResponse {
279 280
  common.Status status = 1;
  common.IndexState state = 2;
281 282
}

X
xige-16 已提交
283
message DropIndexRequest {
Z
zhenshan.cao 已提交
284
  common.MsgBase base = 1; // must
X
xige-16 已提交
285
  string db_name = 2;
Z
zhenshan.cao 已提交
286
  string collection_name = 3; // must
X
xige-16 已提交
287
  string field_name = 4;
Z
zhenshan.cao 已提交
288
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
289 290
}

291
message InsertRequest {
292
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
293
  string db_name = 2;
294 295 296 297
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
298
  uint32 num_rows = 7;
299 300
}

301
message MutationResult {
Z
zhenshan.cao 已提交
302
  common.Status status = 1;
303 304 305 306 307 308 309 310
  schema.IDs IDs = 2; // required for insert, delete
  repeated uint32 succ_index = 3; // error indexes indicate
  repeated uint32 err_index = 4; // error indexes indicate
  bool acknowledged = 5;
  int64 insert_cnt = 6;
  int64 delete_cnt = 7;
  int64 upsert_cnt = 8;
  uint64 timestamp = 9;
Y
yukun 已提交
311 312 313
}

enum PlaceholderType {
G
godchen 已提交
314 315 316
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
317 318 319 320 321 322 323 324 325 326 327
}

message PlaceholderValue {
  string tag = 1;
  PlaceholderType type = 2;
  // values is a 2d-array, every array contains a vector
  repeated bytes values = 3;
}

message PlaceholderGroup {
  repeated PlaceholderValue placeholders = 1;
328 329 330
}

message SearchRequest {
Z
zhenshan.cao 已提交
331
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
332
  string db_name = 2;
Z
zhenshan.cao 已提交
333 334 335
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
336
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
337 338
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
339 340 341
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
342
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
343 344
}

345
message RetrieveRequest {
Z
zhenshan.cao 已提交
346
  common.MsgBase base = 1; // must
347
  string db_name = 2;
Z
zhenshan.cao 已提交
348 349 350 351
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  schema.IDs ids = 5; // must
  repeated string output_fields = 6; // must
352
  uint64 travel_timestamp = 7;
353
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
354 355 356 357 358 359 360 361
}

message RetrieveResults {
  common.Status status = 1;
  schema.IDs ids = 2;
  repeated schema.FieldData fields_data = 3;
}

Y
yukun 已提交
362 363 364 365 366 367
message Hits {
  repeated int64 IDs = 1;
  repeated bytes row_data = 2;
  repeated float scores = 3;
}

368
message SearchResults {
Y
yukun 已提交
369
  common.Status status = 1;
370
  schema.SearchResultData results = 2;
371 372 373
}

message FlushRequest {
374
  common.MsgBase base = 1;
375
  string db_name = 2;
376
  repeated string collection_names = 3;
Y
yukun 已提交
377 378
}

379 380 381 382 383 384
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
385 386 387 388 389 390 391 392 393 394 395 396 397 398
message QueryRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string expr = 4;
  repeated string output_fields = 5;
  repeated string partition_names = 6;
}

message QueryResults {
  common.Status status = 1;
  repeated schema.FieldData fields_data = 2;
}

399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
message VectorIDs {
  string collection_name = 1;
  string field_name = 2;
  schema.IDs id_array = 3;
  repeated string partition_names = 4;
}

message VectorsArray {
  oneof array {
    VectorIDs id_array = 1; // vector ids
    schema.VectorField data_array = 2; // vectors data
  } 
}

message CalcDistanceRequest {
  common.MsgBase base = 1;
  VectorsArray op_left = 2; // vectors on the left of operator
  VectorsArray op_right = 3; // vectors on the right of operator
  repeated common.KeyValuePair params = 4; // "metric":"L2"/"IP"/"HAMMIN"/"TANIMOTO"
}

message CalcDistanceResults {
  common.Status status = 1;
  // num(op_left)*num(op_right) distance values, "HAMMIN" return integer distance
  oneof array {
    	schema.IntArray int_dist = 2;
	schema.FloatArray float_dist = 3;
  }
}

Z
zhenshan.cao 已提交
429 430 431 432
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
433 434
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
435 436
}

G
godchen 已提交
437
message GetPersistentSegmentInfoRequest {
Z
zhenshan.cao 已提交
438
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
439
  string dbName = 2;
Z
zhenshan.cao 已提交
440
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
441 442
}

G
godchen 已提交
443
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
444 445 446 447
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
448 449 450 451 452 453 454 455 456 457
message QuerySegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
  int64 mem_size = 4;
  int64 num_rows = 5;
  string index_name = 6;
  int64 indexID = 7;
}

G
godchen 已提交
458
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
459
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
460
  string dbName = 2;
Z
zhenshan.cao 已提交
461
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
462 463
}

G
godchen 已提交
464
message GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
465 466 467 468
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
469 470 471 472 473 474 475
message DummyRequest {
  string request_type = 1;
}

message DummyResponse {
  string response = 1;
}
Z
zhenshan.cao 已提交
476

G
godchen 已提交
477
message RegisterLinkRequest {
Y
yukun 已提交
478
}
D
dragondriver 已提交
479 480 481 482 483 484 485

message RegisterLinkResponse {
  common.Address address = 1;
  common.Status status = 2;
}

service ProxyService {
G
godchen 已提交
486
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
D
dragondriver 已提交
487
}