File size: 9,085 Bytes
84d2a97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
syntax = "proto3";

import "points.proto";

package qdrant;
option csharp_namespace = "Qdrant.Client.Grpc";

service PointsInternal {
  rpc Upsert (UpsertPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc Sync (SyncPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc Delete (DeletePointsInternal) returns (PointsOperationResponseInternal) {}
  rpc UpdateVectors (UpdateVectorsInternal) returns (PointsOperationResponseInternal) {}
  rpc DeleteVectors (DeleteVectorsInternal) returns (PointsOperationResponseInternal) {}
  rpc SetPayload (SetPayloadPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc OverwritePayload (SetPayloadPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc DeletePayload (DeletePayloadPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc ClearPayload (ClearPayloadPointsInternal) returns (PointsOperationResponseInternal) {}
  rpc CreateFieldIndex (CreateFieldIndexCollectionInternal) returns (PointsOperationResponseInternal) {}
  rpc DeleteFieldIndex (DeleteFieldIndexCollectionInternal) returns (PointsOperationResponseInternal) {}
  rpc CoreSearchBatch (CoreSearchBatchPointsInternal) returns (SearchBatchResponse) {}
  rpc Scroll (ScrollPointsInternal) returns (ScrollResponse) {}
  rpc Count (CountPointsInternal) returns (CountResponse) {}
  rpc Recommend (RecommendPointsInternal) returns (RecommendResponse) {}
  rpc Get (GetPointsInternal) returns (GetResponse) {}
  rpc QueryBatch (QueryBatchPointsInternal) returns (QueryBatchResponseInternal) {}
  rpc Facet(FacetCountsInternal) returns (FacetResponseInternal) {}
}


message SyncPoints {
  string collection_name = 1; // name of the collection
  optional bool wait = 2; // Wait until the changes have been applied?
  repeated PointStruct points = 3;
  optional PointId from_id = 4; // Start of the sync range
  optional PointId to_id = 5; // End of the sync range
  optional WriteOrdering ordering = 6;
}

message SyncPointsInternal {
  SyncPoints sync_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message UpsertPointsInternal {
  UpsertPoints upsert_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message DeletePointsInternal {
  DeletePoints delete_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message UpdateVectorsInternal {
  UpdatePointVectors update_vectors = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message DeleteVectorsInternal {
  DeletePointVectors delete_vectors = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message SetPayloadPointsInternal {
  SetPayloadPoints set_payload_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message DeletePayloadPointsInternal {
  DeletePayloadPoints delete_payload_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message ClearPayloadPointsInternal {
  ClearPayloadPoints clear_payload_points = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message CreateFieldIndexCollectionInternal {
  CreateFieldIndexCollection create_field_index_collection = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

message DeleteFieldIndexCollectionInternal {
  DeleteFieldIndexCollection delete_field_index_collection = 1;
  optional uint32 shard_id = 2;
  optional ClockTag clock_tag = 3;
}

// Has to be backward compatible with `PointsOperationResponse`!
message PointsOperationResponseInternal {
  UpdateResultInternal result = 1;
  double time = 2; // Time spent to process
}

// Has to be backward compatible with `UpdateResult`!
message UpdateResultInternal {
  optional uint64 operation_id = 1; // Number of operation
  UpdateStatus status = 2; // Operation status
  optional ClockTag clock_tag = 3;
}

message ClockTag {
  uint64 peer_id = 1;
  uint32 clock_id = 2;
  uint64 clock_tick = 3;
  uint64 token = 4;
  bool force = 5;
}

message SearchPointsInternal {
  SearchPoints search_points = 1;
  optional uint32 shard_id = 2;
}

message SearchBatchPointsInternal {
  string collection_name = 1;
  repeated SearchPoints search_points = 2;
  optional uint32 shard_id = 3;
  optional uint64 timeout = 4;
}

message RecoQuery {
  repeated Vector positives = 1;
  repeated Vector negatives = 2;
}

message ContextPair {
  Vector positive = 1;
  Vector negative = 2;
}

message DiscoveryQuery {
  Vector target = 1;
  repeated ContextPair context = 2;
}

message ContextQuery {
  repeated ContextPair context = 1;
}

message QueryEnum {
  oneof query {
    Vector nearest_neighbors = 1; // ANN
    RecoQuery recommend_best_score = 2; // Recommend points with higher similarity to positive examples
    DiscoveryQuery discover = 3; // Search for points that get closer to a target, constrained by a context of positive and negative pairs
    ContextQuery context = 4; // Use only the context to find points that minimize loss against negative examples
  }
}

// This is only used internally, so it makes more sense to add it here rather than in points.proto
message CoreSearchPoints {
  string collection_name = 1;
  QueryEnum query = 2;
  Filter filter = 3;
  uint64 limit = 4;
  WithPayloadSelector with_payload = 5;
  SearchParams params = 6;
  optional float score_threshold = 7;
  optional uint64 offset = 8;
  optional string vector_name = 9;
  optional WithVectorsSelector with_vectors = 10;
  optional ReadConsistency read_consistency = 11;
}

message CoreSearchBatchPointsInternal {
  string collection_name = 1;
  repeated CoreSearchPoints search_points = 2;
  optional uint32 shard_id = 3;
  optional uint64 timeout = 4;
}

message ScrollPointsInternal {
  ScrollPoints scroll_points = 1;
  optional uint32 shard_id = 2;
}

message RecommendPointsInternal {
  RecommendPoints recommend_points = 1;
  optional uint32 shard_id = 2;
}

message GetPointsInternal {
  GetPoints get_points = 1;
  optional uint32 shard_id = 2;
}

message CountPointsInternal {
  CountPoints count_points = 1;
  optional uint32 shard_id = 2;
}

// A bare vector. No id reference here.
message RawVector {
  oneof variant {
    DenseVector dense = 1;
    SparseVector sparse = 2;
    MultiDenseVector multi_dense = 3;
  }
}

// Query variants for raw vectors (ids have been substituted with vectors)
message RawQuery {
  message Recommend {
    repeated RawVector positives = 1;
    repeated RawVector negatives = 2;
  }

  message RawContextPair {
    RawVector positive = 1;
    RawVector negative = 2;
  }

  message Discovery {
    RawVector target = 1;
    repeated RawContextPair context = 2;
  }

  message Context {
    repeated RawContextPair context = 1;
  }

  oneof variant {
    RawVector nearest = 1; // ANN
    Recommend recommend_best_score = 2; // Recommend points with highest similarity to positive examples, or lowest to negative examples
    Discovery discover = 3; // Search for points that get closer to a target, constrained by a context of positive and negative pairs
    Context context = 4; // Use only the context to find points that minimize loss against negative examples
  }
}

message QueryShardPoints {
  message Query {
    oneof score {
      RawQuery vector = 1; // (re)score against a vector query
      Fusion fusion = 2; // One of the fusion methods
      OrderBy order_by = 3; // Order by a field
      Sample sample = 4; // Sample points
    }
  }

  message Prefetch {
    repeated Prefetch prefetch = 1;
    Query query = 2;
    optional string using = 3;
    Filter filter = 4;
    uint64 limit = 5;
    SearchParams params = 6;
    optional float score_threshold = 7;
  }

  repeated Prefetch prefetch = 1;
  Query query = 2;
  optional string using = 3;
  Filter filter = 4;
  uint64 limit = 5;
  SearchParams params = 6;
  optional float score_threshold = 7;
  uint64 offset = 8;
  WithPayloadSelector with_payload = 9;
  WithVectorsSelector with_vectors = 10;
}

message QueryBatchPointsInternal {
  string collection_name = 1;
  repeated QueryShardPoints query_points = 2;
  optional uint32 shard_id = 3;
  optional uint64 timeout = 4;
}

message IntermediateResult {
  repeated ScoredPoint result = 1;
}

message QueryResultInternal {
    repeated IntermediateResult intermediate_results = 1;
}

message QueryBatchResponseInternal {
  repeated QueryResultInternal results = 1;
  double time = 2; // Time spent to process
  optional HardwareUsage usage = 5;
}

message FacetCountsInternal {
    string collection_name = 1;
    string key = 2;
    optional Filter filter = 3;
    uint64 limit = 4;
    bool exact = 5;
    uint32 shard_id = 6;
    optional uint64 timeout = 7;
}

message FacetValueInternal {
    oneof variant {
        string keyword_value = 1;
        int64 integer_value = 2;
        bytes uuid_value = 3;
        bool bool_value = 4;
    }
}

message FacetHitInternal {
    FacetValueInternal value = 1;
    uint64 count = 2;
}

message FacetResponseInternal {
    repeated FacetHitInternal hits = 1;
    double time = 2; // Time spent to process
}