milvus.proto 16.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
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) {}

Y
Yusup 已提交
27 28 29 30
  rpc CreateAlias(CreateAliasRequest) returns (common.Status) {}
  rpc DropAlias(DropAliasRequest) returns (common.Status) {}
  rpc AlterAlias(AlterAliasRequest) returns (common.Status) {}

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

37
  rpc Insert(InsertRequest) returns (MutationResult) {}
G
groot 已提交
38
  rpc Delete(DeleteRequest) returns (MutationResult) {}
G
godchen 已提交
39
  rpc Search(SearchRequest) returns (SearchResults) {}
40
  rpc Flush(FlushRequest) returns (FlushResponse) {}
X
Xiangyu Wang 已提交
41
  rpc Query(QueryRequest) returns (QueryResults) {}
42
  rpc CalcDistance(CalcDistanceRequest) returns (CalcDistanceResults) {}
G
godchen 已提交
43 44 45 46

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

X
Xiangyu Wang 已提交
47 48
  rpc Dummy(DummyRequest) returns (DummyResponse) {}

G
godchen 已提交
49 50
  // TODO: remove
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
51 52 53

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

Y
Yusup 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
message CreateAliasRequest {
  common.MsgBase base = 1;
  string collection_name = 2;
  string alias = 3;
}

message DropAliasRequest {
  common.MsgBase base = 1;
  string alias = 2;
}

message AlterAliasRequest{
  common.MsgBase base = 1;
  string collection_name = 2;
  string alias = 3;
}

73
/**
Y
Yusup 已提交
74
* Create collection in milvus
75
*/
76
message CreateCollectionRequest {
77 78 79
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
80
  string db_name = 2;
81 82 83 84 85
  // 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)
86
  // https://github.com/milvus-io/milvus/issues/6690
87
  int32 shards_num = 5;
88 89
}

90 91 92
/**
* Drop collection in milvus, also will drop data in collection. 
*/
93
message DropCollectionRequest {
94 95 96
  // Not useful for now
  common.MsgBase base = 1; 
  // Not useful for now
Z
zhenshan.cao 已提交
97
  string db_name = 2;
98 99
  // The unique collection name in milvus.(Required)
  string collection_name = 3;
100 101
}

102 103 104
/**
* Check collection exist in milvus or not.
*/
105
message HasCollectionRequest {
106 107 108
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
109
  string db_name = 2;
110 111 112
  // The collection name you want to check.
  string collection_name = 3; 
  // Not useful for now
N
neza2017 已提交
113
  uint64 time_stamp = 4;
114 115
}

116

Y
yukun 已提交
117 118 119 120 121
message BoolResponse {
  common.Status status = 1;
  bool value = 2;
}

Z
zhenshan.cao 已提交
122 123 124 125 126
message StringResponse {
  common.Status status = 1;
  string value = 2;
}

127 128 129
/**
* Get collection meta datas like: schema, collectionID, shards number ...
*/
130
message DescribeCollectionRequest {
131 132 133
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
134
  string db_name = 2;
135 136 137
  // The collection name you want to describe
  string collection_name = 3;
  // Not useful for now
N
neza2017 已提交
138
  int64 collectionID = 4;
139
  // Not useful for now
N
neza2017 已提交
140
  uint64 time_stamp = 5;
141 142
}

143 144 145
/**
* DescribeCollection Response
*/
146
message DescribeCollectionResponse {
147
  // Contain error_code and reason
Y
yukun 已提交
148
  common.Status status = 1;
149
  // The schema param when you created collection.
Y
yukun 已提交
150
  schema.CollectionSchema schema = 2;
151
  // The collection id
152
  int64 collectionID = 3;
153
  // System design related, users should not perceive
154
  repeated string virtual_channel_names = 4;
155
  // System design related, users should not perceive
156
  repeated string physical_channel_names = 5;
157 158 159 160 161
  // 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.
Y
Yusup 已提交
162 163 164
  int32 shards_num = 8;
  // The aliases of this collection
  repeated string aliases = 9;
165 166
  // The message ID/posititon when collection is created
  repeated common.KeyDataPair start_positions = 10;
167 168
}

169 170 171
/**
* Load collection data into query nodes, then you can do vector search on this collection.
*/
172
message LoadCollectionRequest {
173 174 175
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
176
  string db_name = 2;
177 178
  // The collection name you want to load
  string collection_name = 3;
179 180
}

181 182 183
/**
* Release collection data from query nodes, then you can't do vector search on this collection.
*/
184
message ReleaseCollectionRequest {
185 186 187
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
188
  string db_name = 2;
189 190
  // The collection name you want to release
  string collection_name = 3;
191 192
}

193 194 195
/**
* Get collection statistics like row_count.
*/
G
godchen 已提交
196
message GetCollectionStatisticsRequest {
197 198 199
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
200
  string db_name = 2;
201 202
  // The collection name you want get statistics
  string collection_name = 3;
203 204
}

205 206 207
/**
* Will return collection statistics in stats field like [{key:"row_count",value:"1"}]
*/
G
godchen 已提交
208
message GetCollectionStatisticsResponse {
209
  // Contain error_code and reason
Z
zhenshan.cao 已提交
210
  common.Status status = 1;
211
  // Collection statistics data
Z
zhenshan.cao 已提交
212
  repeated common.KeyValuePair stats = 2;
213 214
}

215 216 217
/*
* This is for ShowCollectionsRequest type field.
*/
218
enum ShowType {
219
  // Will return all colloections 
220
  All = 0;
221
  // Will return loaded collections with their inMemory_percentages
222 223 224
  InMemory = 1;
}

225 226 227
/*
* List collections 
*/
G
godchen 已提交
228
message ShowCollectionsRequest {
229 230 231
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
232
  string db_name = 2;
233
  // Not useful for now
N
neza2017 已提交
234
  uint64 time_stamp = 3;
235
  // Decide return Loaded collections or All collections(Optional)
236
  ShowType type = 4;
237 238
  // When type is InMemory, will return these collection's inMemory_percentages.(Optional)
  repeated string collection_names = 5; 
239 240
}

241 242 243
/*
* Return basic collection infos.
*/
G
godchen 已提交
244
message ShowCollectionsResponse {
245
  // Contain error_code and reason
Z
zhenshan.cao 已提交
246
  common.Status status = 1;
247
  // Collection name array
Z
zhenshan.cao 已提交
248
  repeated string collection_names = 2;
249
  // Collection Id array
250
  repeated int64 collection_ids = 3;
251 252 253 254 255 256
  // Hybrid timestamps in milvus
  repeated uint64 created_timestamps = 4;
  // The utc timestamp calculated by created_timestamp
  repeated uint64 created_utc_timestamps = 5;
  // Load percentage on querynode when type is InMemory
  repeated int64 inMemory_percentages = 6; 
257 258
}

259 260 261
/*
* Create partition in created collection.
*/
262
message CreatePartitionRequest {
263 264 265
  // Not useful for now
  common.MsgBase base = 1;
  // Not useful for now
Z
zhenshan.cao 已提交
266
  string db_name = 2;
267 268 269 270
  // The collection name in milvus
  string collection_name = 3;
  // The partition name you want to create.
  string partition_name = 4;
271 272 273
}

message DropPartitionRequest {
Z
zhenshan.cao 已提交
274
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
275
  string db_name = 2;
Z
zhenshan.cao 已提交
276 277
  string collection_name = 3; // must
  string partition_name = 4; // must
278 279 280
}

message HasPartitionRequest {
Z
zhenshan.cao 已提交
281
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
282
  string db_name = 2;
Z
zhenshan.cao 已提交
283 284
  string collection_name = 3; // must
  string partition_name = 4; // must
285 286
}

G
godchen 已提交
287
message LoadPartitionsRequest {
Z
zhenshan.cao 已提交
288
  common.MsgBase base = 1; // must
289
  string db_name = 2;
Z
zhenshan.cao 已提交
290 291
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
292 293
}

G
godchen 已提交
294
message ReleasePartitionsRequest {
Z
zhenshan.cao 已提交
295
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
296
  string db_name = 2;
Z
zhenshan.cao 已提交
297 298
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
299 300
}

G
godchen 已提交
301
message GetPartitionStatisticsRequest {
Z
zhenshan.cao 已提交
302
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
303
  string db_name = 2;
Z
zhenshan.cao 已提交
304 305
  string collection_name = 3; // must
  string partition_name = 4; // must
306 307
}

G
godchen 已提交
308
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
309 310
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
311 312
}

G
godchen 已提交
313
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
314
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
315
  string db_name = 2;
Z
zhenshan.cao 已提交
316
  string collection_name = 3; // must
317
  int64 collectionID = 4;
318 319
  repeated string partition_names = 5; // show partition in querynode, showType = InMemory
  ShowType type = 6;
320 321
}

G
godchen 已提交
322
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
323 324 325
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
326 327
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
328
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
329 330 331 332 333 334 335 336 337 338 339
}

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

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
340
  int64 buildID = 3;
341
  bool enable_index = 4;
342 343
}

G
godchen 已提交
344
message ShowSegmentsRequest {
345 346 347 348 349
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
350
message ShowSegmentsResponse {
351 352 353
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
354 355

message CreateIndexRequest {
Z
zhenshan.cao 已提交
356
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
357
  string db_name = 2;
Z
zhenshan.cao 已提交
358 359 360
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
361 362 363
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
364
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
365
  string db_name = 2;
Z
zhenshan.cao 已提交
366
  string collection_name = 3; // must
367
  string field_name = 4;
Z
zhenshan.cao 已提交
368
  string index_name = 5; // No need to set up for now @2021.06.30
369 370 371 372
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
373
  int64 indexID = 2;
374
  repeated common.KeyValuePair params = 3;
375
  string field_name = 4;
376 377 378
}

message DescribeIndexResponse {
379 380 381 382
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

383
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
384
  common.MsgBase base = 1; // must
385
  string db_name = 2 ;
Z
zhenshan.cao 已提交
386
  string collection_name = 3; // must
387
  string field_name = 4;
Z
zhenshan.cao 已提交
388
  string index_name = 5; // must
389 390 391 392 393 394 395 396
}

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

G
godchen 已提交
397
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
398
  common.MsgBase base = 1; // must
399
  string db_name = 2 ;
Z
zhenshan.cao 已提交
400
  string collection_name = 3; // must
401
  string field_name = 4;
Z
zhenshan.cao 已提交
402
  string index_name = 5; // No need to set up for now @2021.06.30
403 404
}

G
godchen 已提交
405
message GetIndexStateResponse {
406 407
  common.Status status = 1;
  common.IndexState state = 2;
408
  string fail_reason = 3;
409 410
}

X
xige-16 已提交
411
message DropIndexRequest {
Z
zhenshan.cao 已提交
412
  common.MsgBase base = 1; // must
X
xige-16 已提交
413
  string db_name = 2;
Z
zhenshan.cao 已提交
414
  string collection_name = 3; // must
X
xige-16 已提交
415
  string field_name = 4;
Z
zhenshan.cao 已提交
416
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
417 418
}

419
message InsertRequest {
420
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
421
  string db_name = 2;
422 423 424 425
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
426
  uint32 num_rows = 7;
427 428
}

429
message MutationResult {
Z
zhenshan.cao 已提交
430
  common.Status status = 1;
431 432 433 434 435 436 437 438
  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 已提交
439 440
}

G
groot 已提交
441 442 443 444 445 446 447 448
message DeleteRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string partition_name = 4;
  string expr = 5;
}

Y
yukun 已提交
449
enum PlaceholderType {
G
godchen 已提交
450 451 452
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
453 454 455 456 457 458 459 460 461 462 463
}

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;
464 465 466
}

message SearchRequest {
Z
zhenshan.cao 已提交
467
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
468
  string db_name = 2;
Z
zhenshan.cao 已提交
469 470 471
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
472
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
473 474
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
475 476 477
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
478
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
479 480 481 482 483 484 485 486
}

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

487
message SearchResults {
Y
yukun 已提交
488
  common.Status status = 1;
489
  schema.SearchResultData results = 2;
490 491 492
}

message FlushRequest {
493
  common.MsgBase base = 1;
494
  string db_name = 2;
495
  repeated string collection_names = 3;
Y
yukun 已提交
496 497
}

498 499 500 501 502 503
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
504 505 506 507 508 509 510
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;
511 512
  uint64 travel_timestamp = 7;
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
X
Xiangyu Wang 已提交
513 514 515 516 517 518 519
}

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

520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
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 已提交
550 551 552 553
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
554 555
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
556 557
}

G
godchen 已提交
558
message GetPersistentSegmentInfoRequest {
Z
zhenshan.cao 已提交
559
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
560
  string dbName = 2;
Z
zhenshan.cao 已提交
561
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
562 563
}

G
godchen 已提交
564
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
565 566 567 568
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
569 570 571 572 573 574 575 576 577 578
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 已提交
579
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
580
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
581
  string dbName = 2;
Z
zhenshan.cao 已提交
582
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
583 584
}

G
godchen 已提交
585
message GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
586 587 588 589
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
590 591 592 593 594 595 596
message DummyRequest {
  string request_type = 1;
}

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

G
godchen 已提交
598
message RegisterLinkRequest {
Y
yukun 已提交
599
}
D
dragondriver 已提交
600 601 602 603 604 605

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

606 607 608 609 610 611 612 613 614 615 616
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 已提交
617
service ProxyService {
G
godchen 已提交
618
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
Y
Yusup 已提交
619
}