milvus.proto 13.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
message CreateCollectionRequest {
Z
zhenshan.cao 已提交
53
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
54
  string db_name = 2;
Z
zhenshan.cao 已提交
55
  string collection_name = 3; // must
Y
yukun 已提交
56
  // `schema` is the serialized `schema.CollectionSchema`
Z
zhenshan.cao 已提交
57 58
  bytes schema = 4; // must
  int32 shards_num = 5; // must. Once set, no modification is allowed
59 60 61
}

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

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

Y
yukun 已提交
74 75 76 77 78
message BoolResponse {
  common.Status status = 1;
  bool value = 2;
}

Z
zhenshan.cao 已提交
79 80 81 82 83
message StringResponse {
  common.Status status = 1;
  string value = 2;
}

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

message DescribeCollectionResponse {
Y
yukun 已提交
93 94
  common.Status status = 1;
  schema.CollectionSchema schema = 2;
95
  int64 collectionID = 3;
96 97
  repeated string virtual_channel_names = 4;
  repeated string physical_channel_names = 5;
98 99
  uint64 created_timestamp = 6; // hybrid timestamp
  uint64 created_utc_timestamp = 7; // physical timestamp
100
  int32 shards_num = 8; // shards number
101 102 103
}

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

message ReleaseCollectionRequest {
Z
zhenshan.cao 已提交
110
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
111
  string db_name = 2;
Z
zhenshan.cao 已提交
112
  string collection_name = 3; // must
113 114
}

G
godchen 已提交
115
message GetCollectionStatisticsRequest {
Z
zhenshan.cao 已提交
116
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
117
  string db_name = 2;
Z
zhenshan.cao 已提交
118
  string collection_name = 3; // must
119 120
}

G
godchen 已提交
121
message GetCollectionStatisticsResponse {
Z
zhenshan.cao 已提交
122 123
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
124 125
}

126
enum ShowType {
127 128 129 130
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
131
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
132
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
133
  string db_name = 2;
N
neza2017 已提交
134
  uint64 time_stamp = 3;
135 136
  ShowType type = 4;
  repeated string collection_names = 5; // show collection in querynode, showType = InMemory
137 138
}

G
godchen 已提交
139
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
140 141
  common.Status status = 1;
  repeated string collection_names = 2;
142
  repeated int64 collection_ids = 3;
143 144
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
145
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
146 147 148
}

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

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

message HasPartitionRequest {
Z
zhenshan.cao 已提交
163
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
164
  string db_name = 2;
Z
zhenshan.cao 已提交
165 166
  string collection_name = 3; // must
  string partition_name = 4; // must
167 168
}

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

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

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

G
godchen 已提交
190
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
191 192
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
193 194
}

G
godchen 已提交
195
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
196
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
197
  string db_name = 2;
Z
zhenshan.cao 已提交
198
  string collection_name = 3; // must
199
  int64 collectionID = 4;
200 201
  repeated string partition_names = 5; // show partition in querynode, showType = InMemory
  ShowType type = 6;
202 203
}

G
godchen 已提交
204
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
205 206 207
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
208 209
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
210
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
211 212 213 214 215 216 217 218 219 220 221
}

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

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
222
  int64 buildID = 3;
223
  bool enable_index = 4;
224 225
}

G
godchen 已提交
226
message ShowSegmentsRequest {
227 228 229 230 231
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
232
message ShowSegmentsResponse {
233 234 235
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
236 237

message CreateIndexRequest {
Z
zhenshan.cao 已提交
238
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
239
  string db_name = 2;
Z
zhenshan.cao 已提交
240 241 242
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
243 244 245
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
246
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
247
  string db_name = 2;
Z
zhenshan.cao 已提交
248
  string collection_name = 3; // must
249
  string field_name = 4;
Z
zhenshan.cao 已提交
250
  string index_name = 5; // No need to set up for now @2021.06.30
251 252 253 254
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
255
  int64 indexID = 2;
256
  repeated common.KeyValuePair params = 3;
257
  string field_name = 4;
258 259 260
}

message DescribeIndexResponse {
261 262 263 264
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

265
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
266
  common.MsgBase base = 1; // must
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; // must
271 272 273 274 275 276 277 278
}

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

G
godchen 已提交
279
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
280
  common.MsgBase base = 1; // must
281
  string db_name = 2 ;
Z
zhenshan.cao 已提交
282
  string collection_name = 3; // must
283
  string field_name = 4;
Z
zhenshan.cao 已提交
284
  string index_name = 5; // No need to set up for now @2021.06.30
285 286
}

G
godchen 已提交
287
message GetIndexStateResponse {
288 289
  common.Status status = 1;
  common.IndexState state = 2;
290
  string fail_reason = 3;
291 292
}

X
xige-16 已提交
293
message DropIndexRequest {
Z
zhenshan.cao 已提交
294
  common.MsgBase base = 1; // must
X
xige-16 已提交
295
  string db_name = 2;
Z
zhenshan.cao 已提交
296
  string collection_name = 3; // must
X
xige-16 已提交
297
  string field_name = 4;
Z
zhenshan.cao 已提交
298
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
299 300
}

301
message InsertRequest {
302
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
303
  string db_name = 2;
304 305 306 307
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
308
  uint32 num_rows = 7;
309 310
}

311
message MutationResult {
Z
zhenshan.cao 已提交
312
  common.Status status = 1;
313 314 315 316 317 318 319 320
  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 已提交
321 322
}

G
groot 已提交
323 324 325 326 327 328 329 330
message DeleteRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string partition_name = 4;
  string expr = 5;
}

Y
yukun 已提交
331
enum PlaceholderType {
G
godchen 已提交
332 333 334
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
335 336 337 338 339 340 341 342 343 344 345
}

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;
346 347 348
}

message SearchRequest {
Z
zhenshan.cao 已提交
349
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
350
  string db_name = 2;
Z
zhenshan.cao 已提交
351 352 353
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
354
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
355 356
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
357 358 359
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
360
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
361 362 363 364 365 366 367 368
}

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

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

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

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

X
Xiangyu Wang 已提交
386 387 388 389 390 391 392
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;
393 394
  uint64 travel_timestamp = 7;
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
X
Xiangyu Wang 已提交
395 396 397 398 399 400 401
}

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

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 429 430 431
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 已提交
432 433 434 435
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
436 437
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
438 439
}

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

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

Z
zhenshan.cao 已提交
451 452 453 454 455 456 457 458 459 460
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 已提交
461
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
462
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
463
  string dbName = 2;
Z
zhenshan.cao 已提交
464
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
465 466
}

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

X
Xiangyu Wang 已提交
472 473 474 475 476 477 478
message DummyRequest {
  string request_type = 1;
}

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

G
godchen 已提交
480
message RegisterLinkRequest {
Y
yukun 已提交
481
}
D
dragondriver 已提交
482 483 484 485 486 487

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

488 489 490 491 492 493 494 495 496 497 498
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 已提交
499
service ProxyService {
G
godchen 已提交
500
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
D
dragondriver 已提交
501
}