diff --git a/internal/parser/planparserv2/plan_parser_v2.go b/internal/parser/planparserv2/plan_parser_v2.go index ac57bdbbc7..b6123141d5 100644 --- a/internal/parser/planparserv2/plan_parser_v2.go +++ b/internal/parser/planparserv2/plan_parser_v2.go @@ -10,6 +10,7 @@ import ( "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/planpb" "github.com/milvus-io/milvus/pkg/log" + "github.com/milvus-io/milvus/pkg/util/merr" "github.com/milvus-io/milvus/pkg/util/typeutil" ) @@ -124,6 +125,10 @@ func CreateSearchPlan(schema *typeutil.SchemaHelper, exprStr string, vectorField log.Info("CreateSearchPlan failed", zap.Error(err)) return nil, err } + // plan ok with schema, check ann field + if !schema.IsFieldLoaded(vectorField.GetFieldID()) { + return nil, merr.WrapErrParameterInvalidMsg("ann field \"%s\" not loaded", vectorFieldName) + } fieldID := vectorField.FieldID dataType := vectorField.DataType