milvus.proto 13.6 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 65
  // 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)
  int32 shards_num = 5;
66 67
}

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

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

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

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

104
message DescribeCollectionRequest {
Z
zhenshan.cao 已提交
105
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
106
  string db_name = 2;
Z
zhenshan.cao 已提交
107
  string collection_name = 3; // must
N
neza2017 已提交
108
  int64 collectionID = 4;
N
neza2017 已提交
109
  uint64 time_stamp = 5;
110 111 112
}

message DescribeCollectionResponse {
Y
yukun 已提交
113 114
  common.Status status = 1;
  schema.CollectionSchema schema = 2;
115
  int64 collectionID = 3;
116 117
  repeated string virtual_channel_names = 4;
  repeated string physical_channel_names = 5;
118 119
  uint64 created_timestamp = 6; // hybrid timestamp
  uint64 created_utc_timestamp = 7; // physical timestamp
120
  int32 shards_num = 8; // shards number
121 122 123
}

message LoadCollectionRequest {
Z
zhenshan.cao 已提交
124
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
125
  string db_name = 2;
Z
zhenshan.cao 已提交
126
  string collection_name = 3; // must
127 128 129
}

message ReleaseCollectionRequest {
Z
zhenshan.cao 已提交
130
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
131
  string db_name = 2;
Z
zhenshan.cao 已提交
132
  string collection_name = 3; // must
133 134
}

G
godchen 已提交
135
message GetCollectionStatisticsRequest {
Z
zhenshan.cao 已提交
136
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
137
  string db_name = 2;
Z
zhenshan.cao 已提交
138
  string collection_name = 3; // must
139 140
}

G
godchen 已提交
141
message GetCollectionStatisticsResponse {
Z
zhenshan.cao 已提交
142 143
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
144 145
}

146
enum ShowType {
147 148 149 150
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
151
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
152
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
153
  string db_name = 2;
N
neza2017 已提交
154
  uint64 time_stamp = 3;
155 156
  ShowType type = 4;
  repeated string collection_names = 5; // show collection in querynode, showType = InMemory
157 158
}

G
godchen 已提交
159
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
160 161
  common.Status status = 1;
  repeated string collection_names = 2;
162
  repeated int64 collection_ids = 3;
163 164
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
165
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
166 167 168
}

message CreatePartitionRequest {
Z
zhenshan.cao 已提交
169
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
170
  string db_name = 2;
Z
zhenshan.cao 已提交
171 172
  string collection_name = 3; // must
  string partition_name = 4; // must
173 174 175
}

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

message HasPartitionRequest {
Z
zhenshan.cao 已提交
183
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
184
  string db_name = 2;
Z
zhenshan.cao 已提交
185 186
  string collection_name = 3; // must
  string partition_name = 4; // must
187 188
}

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

G
godchen 已提交
196
message ReleasePartitionsRequest {
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
  repeated string partition_names = 4; // must
201 202
}

G
godchen 已提交
203
message GetPartitionStatisticsRequest {
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 GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
211 212
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
213 214
}

G
godchen 已提交
215
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
216
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
217
  string db_name = 2;
Z
zhenshan.cao 已提交
218
  string collection_name = 3; // must
219
  int64 collectionID = 4;
220 221
  repeated string partition_names = 5; // show partition in querynode, showType = InMemory
  ShowType type = 6;
222 223
}

G
godchen 已提交
224
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
225 226 227
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
228 229
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
230
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
231 232 233 234 235 236 237 238 239 240 241
}

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

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
242
  int64 buildID = 3;
243
  bool enable_index = 4;
244 245
}

G
godchen 已提交
246
message ShowSegmentsRequest {
247 248 249 250 251
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
252
message ShowSegmentsResponse {
253 254 255
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
256 257

message CreateIndexRequest {
Z
zhenshan.cao 已提交
258
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
259
  string db_name = 2;
Z
zhenshan.cao 已提交
260 261 262
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
263 264 265
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
266
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
267
  string db_name = 2;
Z
zhenshan.cao 已提交
268
  string collection_name = 3; // must
269
  string field_name = 4;
Z
zhenshan.cao 已提交
270
  string index_name = 5; // No need to set up for now @2021.06.30
271 272 273 274
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
275
  int64 indexID = 2;
276
  repeated common.KeyValuePair params = 3;
277
  string field_name = 4;
278 279 280
}

message DescribeIndexResponse {
281 282 283 284
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

285
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
286
  common.MsgBase base = 1; // must
287
  string db_name = 2 ;
Z
zhenshan.cao 已提交
288
  string collection_name = 3; // must
289
  string field_name = 4;
Z
zhenshan.cao 已提交
290
  string index_name = 5; // must
291 292 293 294 295 296 297 298
}

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

G
godchen 已提交
299
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
300
  common.MsgBase base = 1; // must
301
  string db_name = 2 ;
Z
zhenshan.cao 已提交
302
  string collection_name = 3; // must
303
  string field_name = 4;
Z
zhenshan.cao 已提交
304
  string index_name = 5; // No need to set up for now @2021.06.30
305 306
}

G
godchen 已提交
307
message GetIndexStateResponse {
308 309
  common.Status status = 1;
  common.IndexState state = 2;
310
  string fail_reason = 3;
311 312
}

X
xige-16 已提交
313
message DropIndexRequest {
Z
zhenshan.cao 已提交
314
  common.MsgBase base = 1; // must
X
xige-16 已提交
315
  string db_name = 2;
Z
zhenshan.cao 已提交
316
  string collection_name = 3; // must
X
xige-16 已提交
317
  string field_name = 4;
Z
zhenshan.cao 已提交
318
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
319 320
}

321
message InsertRequest {
322
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
323
  string db_name = 2;
324 325 326 327
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
328
  uint32 num_rows = 7;
329 330
}

331
message MutationResult {
Z
zhenshan.cao 已提交
332
  common.Status status = 1;
333 334 335 336 337 338 339 340
  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 已提交
341 342
}

G
groot 已提交
343 344 345 346 347 348 349 350
message DeleteRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string partition_name = 4;
  string expr = 5;
}

Y
yukun 已提交
351
enum PlaceholderType {
G
godchen 已提交
352 353 354
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
355 356 357 358 359 360 361 362 363 364 365
}

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;
366 367 368
}

message SearchRequest {
Z
zhenshan.cao 已提交
369
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
370
  string db_name = 2;
Z
zhenshan.cao 已提交
371 372 373
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
374
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
375 376
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
377 378 379
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
380
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
381 382 383 384 385 386 387 388
}

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

389
message SearchResults {
Y
yukun 已提交
390
  common.Status status = 1;
391
  schema.SearchResultData results = 2;
392 393 394
}

message FlushRequest {
395
  common.MsgBase base = 1;
396
  string db_name = 2;
397
  repeated string collection_names = 3;
Y
yukun 已提交
398 399
}

400 401 402 403 404 405
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
406 407 408 409 410 411 412
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;
413 414
  uint64 travel_timestamp = 7;
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
X
Xiangyu Wang 已提交
415 416 417 418 419 420 421
}

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

422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
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 已提交
452 453 454 455
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
456 457
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
458 459
}

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

G
godchen 已提交
466
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
467 468 469 470
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
471 472 473 474 475 476 477 478 479 480
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 已提交
481
message GetQuerySegmentInfoRequest {
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 GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
488 489 490 491
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
492 493 494 495 496 497 498
message DummyRequest {
  string request_type = 1;
}

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

G
godchen 已提交
500
message RegisterLinkRequest {
Y
yukun 已提交
501
}
D
dragondriver 已提交
502 503 504 505 506 507

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

508 509 510 511 512 513 514 515 516 517 518
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 已提交
519
service ProxyService {
G
godchen 已提交
520
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
D
dragondriver 已提交
521
}