milvus.proto 14.1 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
groot 已提交
34
  rpc Delete(DeleteRequest) returns (MutationResult) {}
G
godchen 已提交
35
  rpc Search(SearchRequest) returns (SearchResults) {}
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
  // TODO: remove
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
47 48 49

  // https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
  rpc GetMetrics(GetMetricsRequest) returns (GetMetricsResponse) {}
G
godchen 已提交
50 51
}

52 53 54
/**
* Create collection in milvus 
*/
55
message CreateCollectionRequest {
56 57 58
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
59
  string db_name = 2;
60 61 62 63 64
  // The unique collection name in milvus.(Required)
  string collection_name = 3; 
  // The serialized `schema.CollectionSchema`(Required)
  bytes schema = 4; 
  // Once set, no modification is allowed (Optional)
65
  // https://github.com/milvus-io/milvus/issues/6690
66
  int32 shards_num = 5;
67 68
}

69 70 71
/**
* Drop collection in milvus, also will drop data in collection. 
*/
72
message DropCollectionRequest {
73 74 75
  // Not useful for now
  common.MsgBase base = 1; 
  // Not useful for now
Z
zhenshan.cao 已提交
76
  string db_name = 2;
77 78
  // The unique collection name in milvus.(Required)
  string collection_name = 3;
79 80
}

81 82 83
/**
* Check collection exist in milvus or not.
*/
84
message HasCollectionRequest {
85 86 87
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
88
  string db_name = 2;
89 90 91
  // The collection name you want to check.
  string collection_name = 3; 
  // Not useful for now
N
neza2017 已提交
92
  uint64 time_stamp = 4;
93 94
}

95

Y
yukun 已提交
96 97 98 99 100
message BoolResponse {
  common.Status status = 1;
  bool value = 2;
}

Z
zhenshan.cao 已提交
101 102 103 104 105
message StringResponse {
  common.Status status = 1;
  string value = 2;
}

106 107 108
/**
* Get collection meta datas like: schema, collectionID, shards number ...
*/
109
message DescribeCollectionRequest {
110 111 112
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
113
  string db_name = 2;
114 115 116
  // The collection name you want to describe
  string collection_name = 3;
  // Not useful for now
N
neza2017 已提交
117
  int64 collectionID = 4;
118
  // Not useful for now
N
neza2017 已提交
119
  uint64 time_stamp = 5;
120 121
}

122 123 124
/**
* DescribeCollection Response
*/
125
message DescribeCollectionResponse {
126
  // Contain error_code and reason
Y
yukun 已提交
127
  common.Status status = 1;
128
  // The schema param when you created collection.
Y
yukun 已提交
129
  schema.CollectionSchema schema = 2;
130
  // The collection id
131
  int64 collectionID = 3;
132
  // System design related, users should not perceive
133
  repeated string virtual_channel_names = 4;
134
  // System design related, users should not perceive
135
  repeated string physical_channel_names = 5;
136 137 138 139 140 141
  // Hybrid timestamp in milvus
  uint64 created_timestamp = 6;
  // The utc timestamp calculated by created_timestamp
  uint64 created_utc_timestamp = 7;
  // The shards number you set.
  int32 shards_num = 8; 
142 143 144
}

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

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

G
godchen 已提交
156
message GetCollectionStatisticsRequest {
Z
zhenshan.cao 已提交
157
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
158
  string db_name = 2;
Z
zhenshan.cao 已提交
159
  string collection_name = 3; // must
160 161
}

G
godchen 已提交
162
message GetCollectionStatisticsResponse {
Z
zhenshan.cao 已提交
163 164
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
165 166
}

167
enum ShowType {
168 169 170 171
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
172
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
173
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
174
  string db_name = 2;
N
neza2017 已提交
175
  uint64 time_stamp = 3;
176 177
  ShowType type = 4;
  repeated string collection_names = 5; // show collection in querynode, showType = InMemory
178 179
}

G
godchen 已提交
180
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
181 182
  common.Status status = 1;
  repeated string collection_names = 2;
183
  repeated int64 collection_ids = 3;
184 185
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
186
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
187 188 189
}

message CreatePartitionRequest {
Z
zhenshan.cao 已提交
190
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
191
  string db_name = 2;
Z
zhenshan.cao 已提交
192 193
  string collection_name = 3; // must
  string partition_name = 4; // must
194 195 196
}

message DropPartitionRequest {
Z
zhenshan.cao 已提交
197
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
198
  string db_name = 2;
Z
zhenshan.cao 已提交
199 200
  string collection_name = 3; // must
  string partition_name = 4; // must
201 202 203
}

message HasPartitionRequest {
Z
zhenshan.cao 已提交
204
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
205
  string db_name = 2;
Z
zhenshan.cao 已提交
206 207
  string collection_name = 3; // must
  string partition_name = 4; // must
208 209
}

G
godchen 已提交
210
message LoadPartitionsRequest {
Z
zhenshan.cao 已提交
211
  common.MsgBase base = 1; // must
212
  string db_name = 2;
Z
zhenshan.cao 已提交
213 214
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
215 216
}

G
godchen 已提交
217
message ReleasePartitionsRequest {
Z
zhenshan.cao 已提交
218
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
219
  string db_name = 2;
Z
zhenshan.cao 已提交
220 221
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
222 223
}

G
godchen 已提交
224
message GetPartitionStatisticsRequest {
Z
zhenshan.cao 已提交
225
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
226
  string db_name = 2;
Z
zhenshan.cao 已提交
227 228
  string collection_name = 3; // must
  string partition_name = 4; // must
229 230
}

G
godchen 已提交
231
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
232 233
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
234 235
}

G
godchen 已提交
236
message ShowPartitionsRequest {
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
  int64 collectionID = 4;
241 242
  repeated string partition_names = 5; // show partition in querynode, showType = InMemory
  ShowType type = 6;
243 244
}

G
godchen 已提交
245
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
246 247 248
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
249 250
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
251
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
252 253 254 255 256 257 258 259 260 261 262
}

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

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
263
  int64 buildID = 3;
264
  bool enable_index = 4;
265 266
}

G
godchen 已提交
267
message ShowSegmentsRequest {
268 269 270 271 272
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
273
message ShowSegmentsResponse {
274 275 276
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
277 278

message CreateIndexRequest {
Z
zhenshan.cao 已提交
279
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
280
  string db_name = 2;
Z
zhenshan.cao 已提交
281 282 283
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
284 285 286
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
287
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
288
  string db_name = 2;
Z
zhenshan.cao 已提交
289
  string collection_name = 3; // must
290
  string field_name = 4;
Z
zhenshan.cao 已提交
291
  string index_name = 5; // No need to set up for now @2021.06.30
292 293 294 295
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
296
  int64 indexID = 2;
297
  repeated common.KeyValuePair params = 3;
298
  string field_name = 4;
299 300 301
}

message DescribeIndexResponse {
302 303 304 305
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

306
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
307
  common.MsgBase base = 1; // must
308
  string db_name = 2 ;
Z
zhenshan.cao 已提交
309
  string collection_name = 3; // must
310
  string field_name = 4;
Z
zhenshan.cao 已提交
311
  string index_name = 5; // must
312 313 314 315 316 317 318 319
}

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

G
godchen 已提交
320
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
321
  common.MsgBase base = 1; // must
322
  string db_name = 2 ;
Z
zhenshan.cao 已提交
323
  string collection_name = 3; // must
324
  string field_name = 4;
Z
zhenshan.cao 已提交
325
  string index_name = 5; // No need to set up for now @2021.06.30
326 327
}

G
godchen 已提交
328
message GetIndexStateResponse {
329 330
  common.Status status = 1;
  common.IndexState state = 2;
331
  string fail_reason = 3;
332 333
}

X
xige-16 已提交
334
message DropIndexRequest {
Z
zhenshan.cao 已提交
335
  common.MsgBase base = 1; // must
X
xige-16 已提交
336
  string db_name = 2;
Z
zhenshan.cao 已提交
337
  string collection_name = 3; // must
X
xige-16 已提交
338
  string field_name = 4;
Z
zhenshan.cao 已提交
339
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
340 341
}

342
message InsertRequest {
343
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
344
  string db_name = 2;
345 346 347 348
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
349
  uint32 num_rows = 7;
350 351
}

352
message MutationResult {
Z
zhenshan.cao 已提交
353
  common.Status status = 1;
354 355 356 357 358 359 360 361
  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 已提交
362 363
}

G
groot 已提交
364 365 366 367 368 369 370 371
message DeleteRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string partition_name = 4;
  string expr = 5;
}

Y
yukun 已提交
372
enum PlaceholderType {
G
godchen 已提交
373 374 375
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
376 377 378 379 380 381 382 383 384 385 386
}

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;
387 388 389
}

message SearchRequest {
Z
zhenshan.cao 已提交
390
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
391
  string db_name = 2;
Z
zhenshan.cao 已提交
392 393 394
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
395
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
396 397
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
398 399 400
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
401
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
402 403 404 405 406 407 408 409
}

message Hits {
  repeated int64 IDs = 1;
  repeated bytes row_data = 2;
  repeated float scores = 3;
}

410
message SearchResults {
Y
yukun 已提交
411
  common.Status status = 1;
412
  schema.SearchResultData results = 2;
413 414 415
}

message FlushRequest {
416
  common.MsgBase base = 1;
417
  string db_name = 2;
418
  repeated string collection_names = 3;
Y
yukun 已提交
419 420
}

421 422 423 424 425 426
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
427 428 429 430 431 432 433
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;
434 435
  uint64 travel_timestamp = 7;
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
X
Xiangyu Wang 已提交
436 437 438 439 440 441 442
}

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

443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
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 已提交
473 474 475 476
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
477 478
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
479 480
}

G
godchen 已提交
481
message GetPersistentSegmentInfoRequest {
Z
zhenshan.cao 已提交
482
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
483
  string dbName = 2;
Z
zhenshan.cao 已提交
484
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
485 486
}

G
godchen 已提交
487
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
488 489 490 491
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
492 493 494 495 496 497 498 499 500 501
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 已提交
502
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
503
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
504
  string dbName = 2;
Z
zhenshan.cao 已提交
505
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
506 507
}

G
godchen 已提交
508
message GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
509 510 511 512
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
513 514 515 516 517 518 519
message DummyRequest {
  string request_type = 1;
}

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

G
godchen 已提交
521
message RegisterLinkRequest {
Y
yukun 已提交
522
}
D
dragondriver 已提交
523 524 525 526 527 528

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

529 530 531 532 533 534 535 536 537 538 539
message GetMetricsRequest {
  common.MsgBase base = 1;
  string request = 2; // request is of jsonic format
}

message GetMetricsResponse {
  common.Status status = 1;
  string response = 2;  // response is of jsonic format
  string component_name = 3; // metrics from which component
}

D
dragondriver 已提交
540
service ProxyService {
G
godchen 已提交
541
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
542
}