diff --git a/pkg/util/indexparamcheck/constraints.go b/pkg/util/indexparamcheck/constraints.go index 2228105b92..55ea516666 100644 --- a/pkg/util/indexparamcheck/constraints.go +++ b/pkg/util/indexparamcheck/constraints.go @@ -64,7 +64,7 @@ var ( ) const ( - FloatVectorDefaultMetricType = metric.IP + FloatVectorDefaultMetricType = metric.COSINE SparseFloatVectorDefaultMetricType = metric.IP - BinaryVectorDefaultMetricType = metric.JACCARD + BinaryVectorDefaultMetricType = metric.HAMMING ) diff --git a/pkg/util/indexparamcheck/hnsw_checker_test.go b/pkg/util/indexparamcheck/hnsw_checker_test.go index fd2499cafc..f68c3794f8 100644 --- a/pkg/util/indexparamcheck/hnsw_checker_test.go +++ b/pkg/util/indexparamcheck/hnsw_checker_test.go @@ -180,15 +180,15 @@ func Test_hnswChecker_SetDefaultMetricType(t *testing.T) { }{ { dType: schemapb.DataType_FloatVector, - metricType: metric.IP, + metricType: metric.COSINE, }, { dType: schemapb.DataType_Float16Vector, - metricType: metric.IP, + metricType: metric.COSINE, }, { dType: schemapb.DataType_BFloat16Vector, - metricType: metric.IP, + metricType: metric.COSINE, }, { dType: schemapb.DataType_SparseFloatVector, @@ -196,7 +196,7 @@ func Test_hnswChecker_SetDefaultMetricType(t *testing.T) { }, { dType: schemapb.DataType_BinaryVector, - metricType: metric.JACCARD, + metricType: metric.HAMMING, }, } diff --git a/pkg/util/paramtable/autoindex_param.go b/pkg/util/paramtable/autoindex_param.go index 36ef52e2ae..0607e6d30b 100644 --- a/pkg/util/paramtable/autoindex_param.go +++ b/pkg/util/paramtable/autoindex_param.go @@ -70,7 +70,7 @@ func (p *autoIndexConfig) init(base *BaseTable) { p.IndexParams = ParamItem{ Key: "autoIndex.params.build", Version: "2.2.0", - DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "IP"}`, + DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "COSINE"}`, Export: true, } p.IndexParams.Init(base.mgr) @@ -86,7 +86,7 @@ func (p *autoIndexConfig) init(base *BaseTable) { p.BinaryIndexParams = ParamItem{ Key: "autoIndex.params.binary.build", Version: "2.4.5", - DefaultValue: `{"nlist": 1024, "index_type": "BIN_IVF_FLAT", "metric_type": "JACCARD"}`, + DefaultValue: `{"nlist": 1024, "index_type": "BIN_IVF_FLAT", "metric_type": "HAMMING"}`, Export: true, } p.BinaryIndexParams.Init(base.mgr) diff --git a/tests/python_client/testcases/test_index.py b/tests/python_client/testcases/test_index.py index 6e9d914625..f3e0e4a2b3 100644 --- a/tests/python_client/testcases/test_index.py +++ b/tests/python_client/testcases/test_index.py @@ -22,7 +22,8 @@ prefix = "index" default_schema = cf.gen_default_collection_schema() default_field_name = ct.default_float_vec_field_name default_index_params = ct.default_index -default_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "IP"} +default_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "COSINE"} +default_sparse_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "IP"} # copied from pymilvus uid = "test_index" @@ -2125,7 +2126,7 @@ class TestAutoIndex(TestcaseBase): """ collection_w = self.init_collection_general(prefix, is_binary=True, is_index=False)[0] collection_w.create_index(binary_field_name, {}) - assert collection_w.index()[0].params == {'index_type': 'AUTOINDEX', 'metric_type': 'JACCARD'} + assert collection_w.index()[0].params == {'index_type': 'AUTOINDEX', 'metric_type': 'HAMMING'} @pytest.mark.tags(CaseLabel.GPU)