@zilliz/milvus2-sdk-node 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/milvus/Client.d.ts +0 -8
- package/dist/milvus/Client.js +0 -17
- package/dist/milvus/Client.js.map +1 -1
- package/dist/milvus/Collection.d.ts +225 -131
- package/dist/milvus/Collection.js +262 -155
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +129 -125
- package/dist/milvus/Data.js +157 -150
- package/dist/milvus/Data.js.map +1 -1
- package/dist/milvus/MilvusIndex.d.ts +57 -53
- package/dist/milvus/MilvusIndex.js +61 -55
- package/dist/milvus/MilvusIndex.js.map +1 -1
- package/dist/milvus/Partition.d.ts +86 -79
- package/dist/milvus/Partition.js +89 -80
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/Resource.d.ts +173 -0
- package/dist/milvus/Resource.js +356 -0
- package/dist/milvus/Resource.js.map +1 -0
- package/dist/milvus/User.d.ts +119 -93
- package/dist/milvus/User.js +133 -100
- package/dist/milvus/User.js.map +1 -1
- package/dist/milvus/Utils.d.ts +1 -1
- package/dist/milvus/const/Milvus.d.ts +272 -0
- package/dist/milvus/const/Milvus.js +375 -0
- package/dist/milvus/const/Milvus.js.map +1 -0
- package/dist/milvus/index.d.ts +3 -1
- package/dist/milvus/index.js +8 -5
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +88 -8
- package/dist/milvus/types/Collection.js +1 -9
- package/dist/milvus/types/Collection.js.map +1 -1
- package/dist/milvus/types/Common.d.ts +11 -267
- package/dist/milvus/types/Common.js +1 -369
- package/dist/milvus/types/Common.js.map +1 -1
- package/dist/milvus/types/Data.d.ts +154 -1
- package/dist/milvus/types/Index.d.ts +20 -1
- package/dist/milvus/types/Partition.d.ts +8 -1
- package/dist/milvus/types/Resource.d.ts +44 -0
- package/dist/milvus/types/{Search.js → Resource.js} +1 -1
- package/dist/milvus/types/Resource.js.map +1 -0
- package/dist/milvus/types/Response.d.ts +0 -246
- package/dist/milvus/types/Response.js.map +1 -1
- package/dist/milvus/types/User.d.ts +53 -1
- package/dist/milvus/types.d.ts +8 -7
- package/dist/milvus/types.js +2 -1
- package/dist/milvus/types.js.map +1 -1
- package/dist/milvus/utils/Format.d.ts +12 -11
- package/dist/milvus/utils/Format.js +27 -18
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/milvus/utils/Validate.d.ts +12 -0
- package/dist/milvus/utils/Validate.js +27 -5
- package/dist/milvus/utils/Validate.js.map +1 -1
- package/dist/proto/proto/common.proto +25 -2
- package/dist/proto/proto/google/protobuf/descriptor.proto +30 -0
- package/dist/proto/proto/milvus.proto +126 -0
- package/dist/proto/proto/msg.proto +107 -0
- package/dist/sdk.json +1 -1
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.js +5 -32
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -10
- package/dist/milvus/types/Search.d.ts +0 -81
- package/dist/milvus/types/Search.js.map +0 -1
|
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
40
40
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
41
|
function step(op) {
|
|
42
42
|
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
44
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
45
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
46
|
switch (op[0]) {
|
|
@@ -67,17 +67,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
67
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
68
|
exports.Collection = void 0;
|
|
69
69
|
var protobufjs_1 = __importDefault(require("protobufjs"));
|
|
70
|
+
var path_1 = __importDefault(require("path"));
|
|
70
71
|
var utils_1 = require("../utils");
|
|
71
72
|
var ErrorReason_1 = require("./const/ErrorReason");
|
|
72
|
-
var Collection_1 = require("./types/Collection");
|
|
73
|
-
var Response_1 = require("./types/Response");
|
|
74
73
|
var Validate_1 = require("./utils/Validate");
|
|
75
|
-
var path_1 = __importDefault(require("path"));
|
|
76
74
|
var Format_1 = require("./utils/Format");
|
|
77
75
|
var Client_1 = require("./Client");
|
|
76
|
+
var Milvus_1 = require("./const/Milvus");
|
|
77
|
+
var types_1 = require("./types");
|
|
78
78
|
var schemaPath = path_1.default.resolve(__dirname, '../proto/proto/schema.proto');
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* @see [collection operation examples](https://github.com/milvus-io/milvus-sdk-node/blob/main/example/Collection.ts)
|
|
81
81
|
*/
|
|
82
82
|
var Collection = /** @class */ (function (_super) {
|
|
83
83
|
__extends(Collection, _super);
|
|
@@ -90,17 +90,17 @@ var Collection = /** @class */ (function (_super) {
|
|
|
90
90
|
* Create a collection in Milvus.
|
|
91
91
|
*
|
|
92
92
|
* @param data
|
|
93
|
-
* | Property
|
|
94
|
-
* |
|
|
95
|
-
* | collection_name
|
|
96
|
-
* | description
|
|
97
|
-
* | consistency_level
|
|
98
|
-
* | fields
|
|
99
|
-
* | timeout
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
93
|
+
* | Property | Type | Description |
|
|
94
|
+
* | :-- | :-- | :-- |
|
|
95
|
+
* | collection_name | String | Collection name |
|
|
96
|
+
* | description | String | Collection description |
|
|
97
|
+
* | consistency_level | String | "Strong"(Milvus default) | "Session" | "Bounded"| "Eventually" | "Customized"; |
|
|
98
|
+
* | fields | <a href="https://github.com/milvus-io/milvus-sdk-node/blob/main/milvus/types/Collection.ts#L8" target="_blank">FieldType</a> | Field data |
|
|
99
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
100
|
+
*
|
|
101
|
+
* @returns
|
|
102
102
|
* | Property | Description |
|
|
103
|
-
* |
|
|
103
|
+
* | :-- | :-- |
|
|
104
104
|
* | error_code | Error code number |
|
|
105
105
|
* | reason | Error cause |
|
|
106
106
|
*
|
|
@@ -131,7 +131,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
131
131
|
*/
|
|
132
132
|
Collection.prototype.createCollection = function (data) {
|
|
133
133
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
var _a, fields, collection_name, description, _b, consistency_level,
|
|
134
|
+
var _a, fields, collection_name, description, _b, consistency_level, CollectionSchema, FieldSchema, payload, collectionParams, schemaBtyes, level, promise;
|
|
135
135
|
return __generator(this, function (_c) {
|
|
136
136
|
switch (_c.label) {
|
|
137
137
|
case 0:
|
|
@@ -140,9 +140,6 @@ var Collection = /** @class */ (function (_super) {
|
|
|
140
140
|
throw new Error(ErrorReason_1.ERROR_REASONS.CREATE_COLLECTION_CHECK_PARAMS);
|
|
141
141
|
}
|
|
142
142
|
(0, Validate_1.checkCollectionFields)(fields);
|
|
143
|
-
return [4 /*yield*/, protobufjs_1.default.load(schemaPath)];
|
|
144
|
-
case 1:
|
|
145
|
-
root = _c.sent();
|
|
146
143
|
CollectionSchema = this._protoRoot.lookupType('milvus.proto.schema.CollectionSchema');
|
|
147
144
|
FieldSchema = this._protoRoot.lookupType('milvus.proto.schema.FieldSchema');
|
|
148
145
|
payload = {
|
|
@@ -157,11 +154,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
157
154
|
});
|
|
158
155
|
collectionParams = CollectionSchema.create(payload);
|
|
159
156
|
schemaBtyes = CollectionSchema.encode(collectionParams).finish();
|
|
160
|
-
level = Object.keys(
|
|
161
|
-
?
|
|
162
|
-
:
|
|
157
|
+
level = Object.keys(Milvus_1.ConsistencyLevelEnum).includes(consistency_level)
|
|
158
|
+
? Milvus_1.ConsistencyLevelEnum[consistency_level]
|
|
159
|
+
: Milvus_1.ConsistencyLevelEnum['Bounded'];
|
|
163
160
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'CreateCollection', __assign(__assign({}, data), { schema: schemaBtyes, consistency_level: level }), data.timeout)];
|
|
164
|
-
case
|
|
161
|
+
case 1:
|
|
165
162
|
promise = _c.sent();
|
|
166
163
|
return [2 /*return*/, promise];
|
|
167
164
|
}
|
|
@@ -172,16 +169,16 @@ var Collection = /** @class */ (function (_super) {
|
|
|
172
169
|
* Check if a collection exists.
|
|
173
170
|
*
|
|
174
171
|
* @param data
|
|
175
|
-
* | Property
|
|
176
|
-
* |
|
|
177
|
-
* | collection_name
|
|
178
|
-
* | timeout
|
|
179
|
-
*
|
|
180
|
-
* @
|
|
181
|
-
* | Property
|
|
182
|
-
* |
|
|
183
|
-
* | status
|
|
184
|
-
* | value
|
|
172
|
+
* | Property | Type | Description |
|
|
173
|
+
* | :-- | :-- | :-- |
|
|
174
|
+
* | collection_name | String | Collection name |
|
|
175
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
176
|
+
*
|
|
177
|
+
* @returns
|
|
178
|
+
* | Property | Description |
|
|
179
|
+
* | :-- | :-- |
|
|
180
|
+
* | status | { error_code: number, reason: string } |
|
|
181
|
+
* | value | `true` or `false` |
|
|
185
182
|
|
|
186
183
|
*
|
|
187
184
|
* #### Example
|
|
@@ -198,7 +195,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
198
195
|
return __generator(this, function (_a) {
|
|
199
196
|
switch (_a.label) {
|
|
200
197
|
case 0:
|
|
201
|
-
|
|
198
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
202
199
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'HasCollection', data, data.timeout)];
|
|
203
200
|
case 1:
|
|
204
201
|
promise = _a.sent();
|
|
@@ -211,17 +208,18 @@ var Collection = /** @class */ (function (_super) {
|
|
|
211
208
|
* List all collections or get collection loading status.
|
|
212
209
|
*
|
|
213
210
|
* @param data
|
|
214
|
-
* | Property
|
|
215
|
-
* |
|
|
216
|
-
* | type(optional)
|
|
217
|
-
* | collection_names(optional)
|
|
218
|
-
* | timeout
|
|
211
|
+
* | Property | Type | Description |
|
|
212
|
+
* | :-- | :-- | :-- |
|
|
213
|
+
* | type(optional) | enum | All -> 0, Loaded -> 1 |
|
|
214
|
+
* | collection_names(optional) | String[] | If `type = Loaded`, Milvus will return `collection_names inMemory_percentages` |
|
|
215
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
216
|
+
|
|
219
217
|
*
|
|
220
|
-
* @
|
|
221
|
-
*
|
|
222
|
-
* |
|
|
223
|
-
* | status
|
|
224
|
-
* | data
|
|
218
|
+
* @returns
|
|
219
|
+
* | Property | Description |
|
|
220
|
+
* | :-- | :-- |
|
|
221
|
+
* | status | { error_code: number, reason: string } |
|
|
222
|
+
* | data | Contains collection name, ID , timestamp (UTC created time), and loadedPercentage (100 means loaded) |
|
|
225
223
|
*
|
|
226
224
|
*
|
|
227
225
|
* #### Example
|
|
@@ -236,7 +234,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
236
234
|
return __generator(this, function (_a) {
|
|
237
235
|
switch (_a.label) {
|
|
238
236
|
case 0: return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'ShowCollections', {
|
|
239
|
-
type: data ? data.type :
|
|
237
|
+
type: data ? data.type : types_1.ShowCollectionsType.All,
|
|
240
238
|
collection_names: (data === null || data === void 0 ? void 0 : data.collection_names) || [],
|
|
241
239
|
}, data === null || data === void 0 ? void 0 : data.timeout)];
|
|
242
240
|
case 1:
|
|
@@ -260,17 +258,17 @@ var Collection = /** @class */ (function (_super) {
|
|
|
260
258
|
* Show the details of a collection, e.g. name, schema.
|
|
261
259
|
*
|
|
262
260
|
* @param data
|
|
263
|
-
* | Property
|
|
264
|
-
* |
|
|
265
|
-
* | collection_name
|
|
266
|
-
* | timeout
|
|
261
|
+
* | Property | Type | Description |
|
|
262
|
+
* | :-- | :-- | :-- |
|
|
263
|
+
* | collection_name | String | Collection name |
|
|
264
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
267
265
|
*
|
|
268
|
-
* @
|
|
269
|
-
*
|
|
270
|
-
* |
|
|
271
|
-
* | status
|
|
272
|
-
* | schema
|
|
273
|
-
* | collectionID |
|
|
266
|
+
* @returns
|
|
267
|
+
* | Property | Description |
|
|
268
|
+
* | :-- | :-- |
|
|
269
|
+
* | status | { error_code: number, reason: string } |
|
|
270
|
+
* | schema | Information of all fields in this collection |
|
|
271
|
+
* | collectionID | Collection ID |
|
|
274
272
|
*
|
|
275
273
|
*
|
|
276
274
|
* #### Example
|
|
@@ -287,7 +285,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
287
285
|
return __generator(this, function (_a) {
|
|
288
286
|
switch (_a.label) {
|
|
289
287
|
case 0:
|
|
290
|
-
|
|
288
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
291
289
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'DescribeCollection', data, data.timeout)];
|
|
292
290
|
case 1:
|
|
293
291
|
promise = _a.sent();
|
|
@@ -300,17 +298,17 @@ var Collection = /** @class */ (function (_super) {
|
|
|
300
298
|
* Show the statistics information of a collection.
|
|
301
299
|
*
|
|
302
300
|
* @param data
|
|
303
|
-
* | Property
|
|
304
|
-
* |
|
|
305
|
-
* | collection_name
|
|
306
|
-
* | timeout
|
|
301
|
+
* | Property | Type | Description |
|
|
302
|
+
* | :-- | :-- | :-- |
|
|
303
|
+
* | collection_name | String | Collection name |
|
|
304
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
307
305
|
*
|
|
308
|
-
* @
|
|
309
|
-
*
|
|
310
|
-
* |
|
|
311
|
-
* | status
|
|
312
|
-
* | stats
|
|
313
|
-
* | data
|
|
306
|
+
* @returns
|
|
307
|
+
* | Property | Description |
|
|
308
|
+
* | :-- | :-- |
|
|
309
|
+
* | status | { error_code: number, reason: string } |
|
|
310
|
+
* | stats | [{key: string, value: string}] |
|
|
311
|
+
* | data | Transform **stats** to { row_count: 0 } |
|
|
314
312
|
*
|
|
315
313
|
*
|
|
316
314
|
* #### Example
|
|
@@ -327,7 +325,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
327
325
|
return __generator(this, function (_a) {
|
|
328
326
|
switch (_a.label) {
|
|
329
327
|
case 0:
|
|
330
|
-
|
|
328
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
331
329
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'GetCollectionStatistics', data, data.timeout)];
|
|
332
330
|
case 1:
|
|
333
331
|
promise = _a.sent();
|
|
@@ -342,17 +340,18 @@ var Collection = /** @class */ (function (_super) {
|
|
|
342
340
|
* It's async function, but we can use showCollections to check loading status.
|
|
343
341
|
*
|
|
344
342
|
* @param data
|
|
345
|
-
* | Property
|
|
346
|
-
* |
|
|
347
|
-
* | collection_name | String |
|
|
348
|
-
* | replica_number?
|
|
349
|
-
* |
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* |
|
|
354
|
-
* |
|
|
355
|
-
* |
|
|
343
|
+
* | Property | Type | Description |
|
|
344
|
+
* | :--- | :-- | :-- |
|
|
345
|
+
* | collection_name | String | Collection name |
|
|
346
|
+
* | replica_number? | number | replica number |
|
|
347
|
+
* | resource_groups? | String[] | resource group names |
|
|
348
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
349
|
+
*
|
|
350
|
+
* @returns
|
|
351
|
+
* | Property | Description |
|
|
352
|
+
* | :-- | :-- |
|
|
353
|
+
* | error_code | Error code number |
|
|
354
|
+
* | reason | Error cause |
|
|
356
355
|
*
|
|
357
356
|
* #### Example
|
|
358
357
|
*
|
|
@@ -368,7 +367,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
368
367
|
return __generator(this, function (_a) {
|
|
369
368
|
switch (_a.label) {
|
|
370
369
|
case 0:
|
|
371
|
-
|
|
370
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
372
371
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'LoadCollection', data, data.timeout)];
|
|
373
372
|
case 1:
|
|
374
373
|
promise = _a.sent();
|
|
@@ -382,16 +381,18 @@ var Collection = /** @class */ (function (_super) {
|
|
|
382
381
|
* Help to ensure this collection is loaded.
|
|
383
382
|
*
|
|
384
383
|
* @param data
|
|
385
|
-
* | Property
|
|
386
|
-
* |
|
|
387
|
-
* | collection_name
|
|
388
|
-
* |
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
* |
|
|
394
|
-
* |
|
|
384
|
+
* | Property | Type | Description |
|
|
385
|
+
* | :--- | :-- | :-- |
|
|
386
|
+
* | collection_name | String | Collection name |
|
|
387
|
+
* | replica_number? | number | replica number |
|
|
388
|
+
* | resource_groups? | String[] | resource group |
|
|
389
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
390
|
+
*
|
|
391
|
+
* @returns
|
|
392
|
+
* | Property | Description |
|
|
393
|
+
* | :-- | :-- |
|
|
394
|
+
* | error_code | Error code number |
|
|
395
|
+
* | reason | Error cause |
|
|
395
396
|
*
|
|
396
397
|
* #### Example
|
|
397
398
|
*
|
|
@@ -407,11 +408,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
407
408
|
return __generator(this, function (_a) {
|
|
408
409
|
switch (_a.label) {
|
|
409
410
|
case 0:
|
|
410
|
-
|
|
411
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
411
412
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'LoadCollection', data, data.timeout)];
|
|
412
413
|
case 1:
|
|
413
414
|
promise = _a.sent();
|
|
414
|
-
if (promise.error_code !==
|
|
415
|
+
if (promise.error_code !== types_1.ErrorCode.SUCCESS) {
|
|
415
416
|
throw new Error("ErrorCode: ".concat(promise.error_code, ". Reason: ").concat(promise.reason));
|
|
416
417
|
}
|
|
417
418
|
loadedPercentage = 0;
|
|
@@ -420,11 +421,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
420
421
|
if (!(Number(loadedPercentage) < 100)) return [3 /*break*/, 4];
|
|
421
422
|
return [4 /*yield*/, this.showCollections({
|
|
422
423
|
collection_names: [data.collection_name],
|
|
423
|
-
type:
|
|
424
|
+
type: types_1.ShowCollectionsType.Loaded,
|
|
424
425
|
})];
|
|
425
426
|
case 3:
|
|
426
427
|
res = _a.sent();
|
|
427
|
-
if (res.status.error_code !==
|
|
428
|
+
if (res.status.error_code !== types_1.ErrorCode.SUCCESS) {
|
|
428
429
|
throw new Error("ErrorCode: ".concat(res.status.error_code, ". Reason: ").concat(res.status.reason));
|
|
429
430
|
}
|
|
430
431
|
// Because we pass collection_names in showCollections, so it will only this collection in result.
|
|
@@ -440,16 +441,16 @@ var Collection = /** @class */ (function (_super) {
|
|
|
440
441
|
* Note that you cannot search while the corresponding collection is unloaded.
|
|
441
442
|
*
|
|
442
443
|
* @param data
|
|
443
|
-
* | Property
|
|
444
|
-
* |
|
|
445
|
-
* | collection_name
|
|
446
|
-
* | timeout
|
|
444
|
+
* | Property | Type | Description |
|
|
445
|
+
* | :-- | :-- | :-- |
|
|
446
|
+
* | collection_name | String | Collection name |
|
|
447
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
447
448
|
*
|
|
448
|
-
* @
|
|
449
|
-
* | Property
|
|
450
|
-
* |
|
|
451
|
-
* | error_code
|
|
452
|
-
* | reason
|
|
449
|
+
* @returns
|
|
450
|
+
* | Property | Description |
|
|
451
|
+
* | :-- | :-- |
|
|
452
|
+
* | error_code | Error code number |
|
|
453
|
+
* | reason | Error cause |
|
|
453
454
|
*
|
|
454
455
|
* #### Example
|
|
455
456
|
*
|
|
@@ -465,7 +466,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
465
466
|
return __generator(this, function (_a) {
|
|
466
467
|
switch (_a.label) {
|
|
467
468
|
case 0:
|
|
468
|
-
|
|
469
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
469
470
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'ReleaseCollection', data, data.timeout)];
|
|
470
471
|
case 1:
|
|
471
472
|
promise = _a.sent();
|
|
@@ -474,20 +475,61 @@ var Collection = /** @class */ (function (_super) {
|
|
|
474
475
|
});
|
|
475
476
|
});
|
|
476
477
|
};
|
|
478
|
+
/**
|
|
479
|
+
* Rename a collection
|
|
480
|
+
*
|
|
481
|
+
* @param data
|
|
482
|
+
* | Property | Type | Description |
|
|
483
|
+
* | :-- | :-- | :-- |
|
|
484
|
+
* | collection_name | String | old collection name |
|
|
485
|
+
* | new_collection_name | String | new collection name |
|
|
486
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
487
|
+
*
|
|
488
|
+
* @returns
|
|
489
|
+
* | Property | Description |
|
|
490
|
+
* | :-- | :-- |
|
|
491
|
+
* | error_code | Error code number |
|
|
492
|
+
* | reason | Error cause |
|
|
493
|
+
*
|
|
494
|
+
* #### Example
|
|
495
|
+
*
|
|
496
|
+
* ```
|
|
497
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.renameCollection({
|
|
498
|
+
* collection_name: 'my_collection',
|
|
499
|
+
* new_collection_name: 'my_new_collection'
|
|
500
|
+
* });
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
Collection.prototype.renameCollection = function (data) {
|
|
504
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
505
|
+
var promise;
|
|
506
|
+
return __generator(this, function (_a) {
|
|
507
|
+
switch (_a.label) {
|
|
508
|
+
case 0: return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'RenameCollection', {
|
|
509
|
+
oldName: data.collection_name,
|
|
510
|
+
newName: data.new_collection_name,
|
|
511
|
+
}, data.timeout)];
|
|
512
|
+
case 1:
|
|
513
|
+
promise = _a.sent();
|
|
514
|
+
return [2 /*return*/, promise];
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
};
|
|
477
519
|
/**
|
|
478
520
|
* Drop a collection. Note that this drops all data in the collection.
|
|
479
521
|
*
|
|
480
522
|
* @param data
|
|
481
|
-
* | Property
|
|
482
|
-
* |
|
|
483
|
-
* | collection_name
|
|
484
|
-
* | timeout
|
|
523
|
+
* | Property | Type | Description |
|
|
524
|
+
* | :-- | :-- | :-- |
|
|
525
|
+
* | collection_name | String | Collection name |
|
|
526
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
485
527
|
*
|
|
486
|
-
* @
|
|
487
|
-
* | Property
|
|
488
|
-
* |
|
|
489
|
-
* | error_code
|
|
490
|
-
* | reason
|
|
528
|
+
* @returns
|
|
529
|
+
* | Property | Description |
|
|
530
|
+
* | :-- | :-- |
|
|
531
|
+
* | error_code | Error code number |
|
|
532
|
+
* | reason | Error cause |
|
|
491
533
|
*
|
|
492
534
|
* #### Example
|
|
493
535
|
*
|
|
@@ -503,7 +545,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
503
545
|
return __generator(this, function (_a) {
|
|
504
546
|
switch (_a.label) {
|
|
505
547
|
case 0:
|
|
506
|
-
|
|
548
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
507
549
|
return [4 /*yield*/, (0, utils_1.promisify)(this.client, 'DropCollection', data, data.timeout)];
|
|
508
550
|
case 1:
|
|
509
551
|
promise = _a.sent();
|
|
@@ -513,9 +555,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
513
555
|
});
|
|
514
556
|
};
|
|
515
557
|
/**
|
|
516
|
-
* @ignore
|
|
517
558
|
* Create collection alias, then you can use alias instead of collection_name when you do vector search
|
|
559
|
+
*
|
|
518
560
|
* @param data
|
|
561
|
+
* | Property | Type | Description |
|
|
562
|
+
* | :-- | :-- | :-- |
|
|
563
|
+
* | alias | String | alias name |
|
|
564
|
+
* | collection_name | String | Collection name |
|
|
565
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
566
|
+
*
|
|
567
|
+
* @returns
|
|
568
|
+
* | Property | Description |
|
|
569
|
+
* | :-- | :-- |
|
|
570
|
+
* | error_code | Error code number |
|
|
571
|
+
* | reason | Error cause |
|
|
572
|
+
*
|
|
573
|
+
*
|
|
574
|
+
* #### Example
|
|
575
|
+
*
|
|
576
|
+
* ```
|
|
577
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.createAlias({
|
|
578
|
+
* alias: 'my_collection_alis',
|
|
579
|
+
* collection_name: 'my_collection',
|
|
580
|
+
* });
|
|
581
|
+
* ```
|
|
519
582
|
*/
|
|
520
583
|
Collection.prototype.createAlias = function (data) {
|
|
521
584
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -523,7 +586,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
523
586
|
return __generator(this, function (_a) {
|
|
524
587
|
switch (_a.label) {
|
|
525
588
|
case 0:
|
|
526
|
-
|
|
589
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
527
590
|
if (!data.alias) {
|
|
528
591
|
throw new Error(ErrorReason_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
529
592
|
}
|
|
@@ -536,8 +599,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
536
599
|
});
|
|
537
600
|
};
|
|
538
601
|
/**
|
|
539
|
-
*
|
|
602
|
+
* Drop a collection alias
|
|
603
|
+
*
|
|
540
604
|
* @param data
|
|
605
|
+
* | Property | Type | Description |
|
|
606
|
+
* | :-- | :-- | :-- |
|
|
607
|
+
* | alias | String | alias name |
|
|
608
|
+
* | collection_name | String | Collection name |
|
|
609
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
610
|
+
*
|
|
611
|
+
* @returns
|
|
612
|
+
* | Property | Description |
|
|
613
|
+
* | :-- | :-- |
|
|
614
|
+
* | error_code | Error code number |
|
|
615
|
+
* | reason | Error cause |
|
|
616
|
+
*
|
|
617
|
+
*
|
|
618
|
+
* #### Example
|
|
619
|
+
*
|
|
620
|
+
* ```
|
|
621
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.dropAlias({
|
|
622
|
+
* alias: 'my_collection_alis',
|
|
623
|
+
* collection_name: 'my_collection',
|
|
624
|
+
* });
|
|
625
|
+
* ```
|
|
541
626
|
*/
|
|
542
627
|
Collection.prototype.dropAlias = function (data) {
|
|
543
628
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -557,8 +642,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
557
642
|
});
|
|
558
643
|
};
|
|
559
644
|
/**
|
|
560
|
-
*
|
|
645
|
+
* alter a collection alias
|
|
646
|
+
*
|
|
561
647
|
* @param data
|
|
648
|
+
* | Property | Type | Description |
|
|
649
|
+
* | :-- | :-- | :-- |
|
|
650
|
+
* | alias | String | alias name |
|
|
651
|
+
* | collection_name | String | Collection name |
|
|
652
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
653
|
+
*
|
|
654
|
+
* @returns
|
|
655
|
+
* | Property | Description |
|
|
656
|
+
* | :-- | :-- |
|
|
657
|
+
* | error_code | Error code number |
|
|
658
|
+
* | reason | Error cause |
|
|
659
|
+
*
|
|
660
|
+
*
|
|
661
|
+
* #### Example
|
|
662
|
+
*
|
|
663
|
+
* ```
|
|
664
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.alterAlais({
|
|
665
|
+
* alias: 'my_collection_alis',
|
|
666
|
+
* collection_name: 'my_collection',
|
|
667
|
+
* });
|
|
668
|
+
* ```
|
|
562
669
|
*/
|
|
563
670
|
Collection.prototype.alterAlias = function (data) {
|
|
564
671
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -566,7 +673,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
566
673
|
return __generator(this, function (_a) {
|
|
567
674
|
switch (_a.label) {
|
|
568
675
|
case 0:
|
|
569
|
-
|
|
676
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
570
677
|
if (!data.alias) {
|
|
571
678
|
throw new Error(ErrorReason_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
572
679
|
}
|
|
@@ -582,16 +689,16 @@ var Collection = /** @class */ (function (_super) {
|
|
|
582
689
|
* Do compaction for the collection.
|
|
583
690
|
*
|
|
584
691
|
* @param data
|
|
585
|
-
* | Property
|
|
586
|
-
* |
|
|
587
|
-
* | collection_name
|
|
588
|
-
* | timeout
|
|
692
|
+
* | Property | Type | Description |
|
|
693
|
+
* | :-- | :-- | :-- |
|
|
694
|
+
* | collection_name | String | The collection name to compact |
|
|
695
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
589
696
|
*
|
|
590
|
-
* @
|
|
591
|
-
* | Property
|
|
592
|
-
* |
|
|
593
|
-
* | status
|
|
594
|
-
* | compactionID
|
|
697
|
+
* @returns
|
|
698
|
+
* | Property | Description |
|
|
699
|
+
* | :-- | :-- |
|
|
700
|
+
* | status | { error_code: number, reason: string } |
|
|
701
|
+
* | compactionID | compaction ID |
|
|
595
702
|
*
|
|
596
703
|
* #### Example
|
|
597
704
|
*
|
|
@@ -607,7 +714,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
607
714
|
return __generator(this, function (_a) {
|
|
608
715
|
switch (_a.label) {
|
|
609
716
|
case 0:
|
|
610
|
-
|
|
717
|
+
(0, Validate_1.checkCollectionName)(data);
|
|
611
718
|
return [4 /*yield*/, this.describeCollection(data)];
|
|
612
719
|
case 1:
|
|
613
720
|
collectionInfo = _a.sent();
|
|
@@ -625,16 +732,16 @@ var Collection = /** @class */ (function (_super) {
|
|
|
625
732
|
* Get compaction states of a targeted compaction id
|
|
626
733
|
*
|
|
627
734
|
* @param data
|
|
628
|
-
* | Property
|
|
629
|
-
* |
|
|
630
|
-
* | compactionID
|
|
631
|
-
* | timeout
|
|
735
|
+
* | Property | Type | Description |
|
|
736
|
+
* | :-- | :-- | :-- |
|
|
737
|
+
* | compactionID | number or string | the id returned by compact |
|
|
738
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
632
739
|
*
|
|
633
|
-
* @
|
|
634
|
-
* | Property
|
|
635
|
-
* |
|
|
636
|
-
* | status
|
|
637
|
-
* | state
|
|
740
|
+
* @returns
|
|
741
|
+
* | Property | Description |
|
|
742
|
+
* | :-- | :-- |
|
|
743
|
+
* | status | { error_code: number, reason: string } |
|
|
744
|
+
* | state | the state of the compaction |
|
|
638
745
|
*
|
|
639
746
|
* #### Example
|
|
640
747
|
*
|
|
@@ -665,16 +772,16 @@ var Collection = /** @class */ (function (_super) {
|
|
|
665
772
|
* Get compaction states of a targeted compaction id
|
|
666
773
|
*
|
|
667
774
|
* @param data
|
|
668
|
-
* | Property
|
|
669
|
-
* |
|
|
670
|
-
* | compactionID
|
|
671
|
-
* | timeout
|
|
775
|
+
* | Property | Type | Description |
|
|
776
|
+
* | :-- | :-- | :-- |
|
|
777
|
+
* | compactionID | number or string | the id returned by compact |
|
|
778
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
672
779
|
*
|
|
673
|
-
* @
|
|
674
|
-
* | Property
|
|
675
|
-
* |
|
|
676
|
-
* | status
|
|
677
|
-
* | state
|
|
780
|
+
* @returns
|
|
781
|
+
* | Property | Description |
|
|
782
|
+
* | :-- | :-- |
|
|
783
|
+
* | status | { error_code: number, reason: string } |
|
|
784
|
+
* | state | the state of the compaction |
|
|
678
785
|
*
|
|
679
786
|
* #### Example
|
|
680
787
|
*
|
|
@@ -705,15 +812,15 @@ var Collection = /** @class */ (function (_super) {
|
|
|
705
812
|
* Get replicas
|
|
706
813
|
*
|
|
707
814
|
* @param data
|
|
708
|
-
* | Property
|
|
709
|
-
* |
|
|
710
|
-
* | collectionID
|
|
711
|
-
* | timeout
|
|
712
|
-
*
|
|
713
|
-
* @
|
|
714
|
-
* | Property
|
|
715
|
-
* |
|
|
716
|
-
* | status
|
|
815
|
+
* | Property | Type | Description |
|
|
816
|
+
* | :-- | :-- | :-- |
|
|
817
|
+
* | collectionID | number or string | the id returned by compact |
|
|
818
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
819
|
+
*
|
|
820
|
+
* @returns
|
|
821
|
+
* | Property | Description |
|
|
822
|
+
* | :-- | :-- |
|
|
823
|
+
* | status | { error_code: number, reason: string } |
|
|
717
824
|
* | ReplicaInfo[] | replica info array |
|
|
718
825
|
*
|
|
719
826
|
* #### Example
|