milvus-io / milvus

A cloud-native vector database, storage for next generation AI applications
https://milvus.io
Apache License 2.0
30.76k stars 2.93k forks source link

[Bug]: The following error is reported when creating an index and selecting HNSW using Milvus. #37629

Open davewxt opened 6 days ago

davewxt commented 6 days ago

Is there an existing issue for this?

Environment

- Milvus version:2.4.15
- Deployment mode(standalone or cluster):cluster
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2):
- OS(Ubuntu or CentOS): Ubuntu 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

2024-11-13 10:07:04.359 ERROR 1 --- [ scheduling-1] io.milvus.v2.utils.RpcUtils : CreateIndexRequest collectionName:meta_collection, fieldName:desc_vector failed, error code: 2, reason: M out of range: [1, 2048]: invalid parameter[expected=valid index params][actual=invalid index params] 2024-11-13 10:07:04.363 ERROR 1 --- [ scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task io.milvus.v2.exception.MilvusClientException: M out of range: [1, 2048]: invalid parameter[expected=valid index params][actual=invalid index params] at io.milvus.v2.utils.RpcUtils.handleResponse(RpcUtils.java:53) ~[milvus-sdk-java-2.4.4.jar!/:na] at io.milvus.v2.service.index.IndexService.createIndex(IndexService.java:73) ~[milvus-sdk-java-2.4.4.jar!/:na] at io.milvus.v2.client.MilvusClientV2.lambda$createIndex$17(MilvusClientV2.java:432) ~[milvus-sdk-java-2.4.4.jar!/:na] at io.milvus.v2.client.MilvusClientV2.retry(MilvusClientV2.java:188) ~[milvus-sdk-java-2.4.4.jar!/:na] at io.milvus.v2.client.MilvusClientV2.createIndex(MilvusClientV2.java:432) ~[milvus-sdk-java-2.4.4.jar!/:na] at com.sanofi.vector.service.MilvusVectorDBWithEmbedding.createIndex(MilvusVectorDBWithEmbedding.java:151) ~[classes!/:1.0-SNAPSHOT] at com.sanofi.vector.service.ScheduledTaskDBToVectorDBService.executeDailyDBCopyMetadataVectorDBTask(ScheduledTaskDBToVectorDBService.java:113) ~[classes!/:1.0-SNAPSHOT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212] at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.3.13.jar!/:5.3.13] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.13.jar!/:5.3.13] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_212] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_212] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_212] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_212] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]

Expected Behavior

  IndexParam indexParamForVectorField = IndexParam.builder()
            .fieldName(filedVector)
            .indexName(indexNameVector)
            .indexType(IndexParam.IndexType.HNSW)
            .metricType(IndexParam.MetricType.COSINE)
            .extraParams(Map.of("M", 64))
            .extraParams(Map.of("efConstruction",250))
            .build();

List indexParams = new ArrayList<>(); indexParams.add(indexParamForVectorField);

  // 4.3 Crate an index file
    CreateIndexReq createIndexReq = CreateIndexReq.builder()
            .collectionName(collectionName)
            .indexParams(indexParams)
            .build();

Steps To Reproduce

1.milvus-sdk 2.4.4
2.jdk 1.8
3. k8s集群

Milvus Log

No response

Anything else?

No response

yanliang567 commented 6 days ago

/assign @liliu-z /unassign