{"record":{"id":"638b1d5d5340a19f","repo":"apache/seatunnel","slug":"create-index-error","errorCode":"CREATE_INDEX_ERROR","errorMessage":"indexType is required for vector index on column '%s'. Please specify it in schema constraintKeys configuration","messagePattern":"indexType is required for vector index on column '(.+?)'\\. Please specify it in schema constraintKeys configuration","errorType":"error_code","errorClass":"MilvusConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/catalog/MilvusCatalog.java","lineNumber":240,"sourceCode":"                    createIndexInternal(tablePath, constraintKey.getColumnNames());\n                }\n            }\n        }\n        log.info(\n                \"Finished creating Milvus collection. database={}, collection={}\",\n                tablePath.getDatabaseName(),\n                tablePath.getTableName());\n    }\n\n    private void createIndexInternal(\n            TablePath tablePath, List<ConstraintKey.ConstraintKeyColumn> vectorIndexes) {\n        for (ConstraintKey.ConstraintKeyColumn column : vectorIndexes) {\n            VectorIndex index = (VectorIndex) column;\n            String fieldName = index.getColumnName();\n            String indexName =\n                    StringUtils.isNotBlank(index.getIndexName()) ? index.getIndexName() : fieldName;\n            if (index.getIndexType() == null) {\n                throw new MilvusConnectorException(\n                        MilvusConnectionErrorCode.CREATE_INDEX_ERROR,\n                        String.format(\n                                \"indexType is required for vector index on column '%s'. \"\n                                        + \"Please specify it in schema constraintKeys configuration\",\n                                fieldName));\n            }\n            if (index.getMetricType() == null) {\n                throw new MilvusConnectorException(\n                        MilvusConnectionErrorCode.CREATE_INDEX_ERROR,\n                        String.format(\n                                \"metricType is required for vector index on column '%s'. \"\n                                        + \"Please specify it in schema constraintKeys configuration\",\n                                fieldName));\n            }\n            log.info(\n                    \"Creating Milvus vector index. database={}, collection={}, field={}, indexName={}, indexType={}, metricType={}\",\n                    tablePath.getDatabaseName(),\n                    tablePath.getTableName(),","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/catalog/MilvusCatalog.java#L222-L258","documentation":"MilvusCatalog.createIndexInternal creates vector indexes from constraintKeys definitions. A VectorIndex without an indexType (e.g. IVF_FLAT, HNSW) cannot be built in Milvus, so it throws MilvusConnectorException with CREATE_INDEX_ERROR telling the user to specify indexType in the schema constraintKeys configuration.","triggerScenarios":"createTable -> createIndexInternal encounters a VectorIndex constraint whose getIndexType() == null, i.e. the constraintKeys block for a vector column omitted the index type parameter.","commonSituations":"Users define constraintKeys for a vector column but only name the column, unaware Milvus requires an explicit index algorithm; configs copied from non-vector examples; schema generated by tools that don't propagate indexType.","solutions":["Add indexType to the VectorIndex definition in schema constraintKeys (e.g. indexType = IVF_FLAT / HNSW / AUTOINDEX).","Ensure the index params are provided as a ConstraintKey of type VectorIndex, not a plain column constraint.","Consult the Milvus connector docs for the exact constraintKeys syntax and supported index types.","Validate the index config locally before running the full pipeline."],"exampleFix":"// before\nconstraintKeys {\n  vector_index {\n    columns = [\"embedding\"]\n  }\n}\n// after\nconstraintKeys {\n  vector_index {\n    indexType = \"HNSW\"\n    metricType = \"L2\"\n    columns = [\"embedding\"]\n  }\n}","handlingStrategy":"validation","validationCode":"for (ConstraintKey ck : catalogTable.getConstraintKeys()) {\n    if (ck instanceof VectorIndex v) {\n        if (v.getIndexType() == null) {\n            throw new IllegalArgumentException(\"Vector index on '\" + v.getColumnName() + \"' missing indexType\");\n        }\n    }\n}","typeGuard":"boolean hasIndexType(VectorIndex idx) { return idx.getIndexType() != null && !idx.getIndexType().isBlank(); }","tryCatchPattern":"try {\n    catalog.createTable(tablePath, catalogTable, false);\n} catch (MilvusConnectorException e) {\n    if (MilvusConnectionErrorCode.CREATE_INDEX_ERROR.equals(e.getSeaTunnelErrorCode())) {\n        log.error(\"Vector index misconfigured: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Always set both indexType and metricType on vector index constraintKeys","Copy vector index examples from the Milvus connector docs, not generic constraint examples","Dry-run table creation against a test Milvus instance"],"tags":["milvus","catalog","index","vector","config"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}