diff --git a/milvus/const/milvus.ts b/milvus/const/milvus.ts index 5a9bd553..ba9d3cba 100644 --- a/milvus/const/milvus.ts +++ b/milvus/const/milvus.ts @@ -129,12 +129,15 @@ export enum IndexType { GPU_IVF_FLAT = 'GPU_IVF_FLAT', GPU_IVF_PQ = 'GPU_IVF_PQ', GPU_IVF_SQ8 = 'GPU_IVF_SQ8', + GPU_BRUTE_FORCE = 'GPU_BRUTE_FORCE', + GPU_CAGRA = 'GPU_CAGRA', RAFT_IVF_FLAT = 'RAFT_IVF_FLAT', RAFT_IVF_PQ = 'RAFT_IVF_PQ', ScaNN = 'SCANN', // scalar STL_SORT = 'STL_SORT', TRIE = 'Trie', + INVERTED = 'INVERTED', } // MsgType diff --git a/test/grpc/Index.spec.ts b/test/grpc/Index.spec.ts index 7c2129be..78a7c79f 100644 --- a/test/grpc/Index.spec.ts +++ b/test/grpc/Index.spec.ts @@ -199,6 +199,36 @@ describe(`Milvus Index API`, () => { expect(res.error_code).toEqual(ErrorCode.SUCCESS); }); + it(`Create STL_SORT index on int64 should success`, async () => { + const res = await milvusClient.createIndex({ + index_name: 'int64_index', + collection_name: COLLECTION_NAME, + field_name: 'int64', + index_type: IndexType.STL_SORT, + }); + expect(res.error_code).toEqual(ErrorCode.SUCCESS); + }); + + it(`Create TRIE index on int64 varchar success`, async () => { + const res = await milvusClient.createIndex({ + index_name: 'varchar_index', + collection_name: COLLECTION_NAME, + field_name: 'varChar', + index_type: IndexType.TRIE, + }); + expect(res.error_code).toEqual(ErrorCode.SUCCESS); + }); + + it(`Create INVERTED index on int64 varchar success`, async () => { + const res = await milvusClient.createIndex({ + index_name: 'float_index', + collection_name: COLLECTION_NAME, + field_name: 'float', + index_type: IndexType.INVERTED, + }); + expect(res.error_code).toEqual(ErrorCode.SUCCESS); + }); + it(`Create Index without name should success`, async () => { const res = await milvusClient.createIndex({ collection_name: COLLECTION_NAME_WITHOUT_INDEX_NAME, @@ -230,7 +260,8 @@ describe(`Milvus Index API`, () => { collection_name: COLLECTION_NAME, index_name: INDEX_NAME, }); - expect(res.index_descriptions[0].index_name).toEqual(INDEX_NAME); + const allIndexNames = res.index_descriptions.map(i => i.index_name); + expect(allIndexNames.includes(INDEX_NAME)).toEqual(true); expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); }); @@ -240,7 +271,9 @@ describe(`Milvus Index API`, () => { field_name: VECTOR_FIELD_NAME, }); - expect(res.index_descriptions[0].field_name).toEqual(VECTOR_FIELD_NAME); + const field_names = res.index_descriptions.map(i => i.field_name); + expect(field_names.includes(VECTOR_FIELD_NAME)).toEqual(true); + expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); }); @@ -283,13 +316,14 @@ describe(`Milvus Index API`, () => { expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); }); - it(`Get Index progress with field name should be failed`, async () => { - const res = await milvusClient.getIndexBuildProgress({ - collection_name: COLLECTION_NAME, - field_name: VECTOR_FIELD_NAME, - }); - expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); - }); + // @Deprecated + // it(`Get Index progress with field name should be failed`, async () => { + // const res = await milvusClient.getIndexBuildProgress({ + // collection_name: COLLECTION_NAME, + // field_name: VECTOR_FIELD_NAME, + // }); + // expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); + // }); it(`Drop Index with index name`, async () => { const res = await milvusClient.dropIndex({