{"record":{"id":"bf8dab9105eb7f79","repo":"Tencent/WeKnora","slug":"source-index-data-missing-chunk-id-field","errorCode":null,"errorMessage":"source index data missing chunk_id field","messagePattern":"source index data missing chunk_id field","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/elasticsearch/v7/repository.go","lineNumber":1172,"sourceCode":"\n\thitMap, ok := hit.(map[string]interface{})\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Invalid hit object format\")\n\t\treturn nil, nil, fmt.Errorf(\"invalid hit object format\")\n\t}\n\n\t// Get document source\n\tsourceObj, ok := hitMap[\"_source\"].(map[string]interface{})\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Hit missing _source field\")\n\t\treturn nil, nil, fmt.Errorf(\"hit missing _source field\")\n\t}\n\n\t// Get source ChunkID and corresponding target ChunkID\n\tsourceChunkID, ok := sourceObj[\"chunk_id\"].(string)\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source index data missing chunk_id field\")\n\t\treturn nil, nil, fmt.Errorf(\"source index data missing chunk_id field\")\n\t}\n\n\ttargetChunkID, ok := sourceToTargetChunkIDMap[sourceChunkID]\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source chunk ID %s not found in mapping\", sourceChunkID)\n\t\treturn nil, nil, fmt.Errorf(\"source chunk ID %s not found in mapping\", sourceChunkID)\n\t}\n\n\t// Get mapped target knowledge ID\n\tsourceKnowledgeID, ok := sourceObj[\"knowledge_id\"].(string)\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source index data missing knowledge_id field\")\n\t\treturn nil, nil, fmt.Errorf(\"source index data missing knowledge_id field\")\n\t}\n\n\ttargetKnowledgeID, ok := sourceToTargetKBIDMap[sourceKnowledgeID]\n\tif !ok {\n\t\tlog.Warnf(\"[ElasticsearchV7] Source knowledge ID %s not found in mapping\", sourceKnowledgeID)","sourceCodeStart":1154,"sourceCodeEnd":1190,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/elasticsearch/v7/repository.go#L1154-L1190","documentation":"Elasticsearch v7 reindex guard: the hit's _source object lacks a string 'chunk_id' field (missing or wrong type), so the source chunk cannot be mapped to its target chunk ID and the hit is rejected during copy/reindex processing.","triggerScenarios":"Thrown at internal/application/repository/retriever/elasticsearch/v7/repository.go:1172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the source index documents include chunk_id","Re-index the source documents with correct field mapping","Skip hits with absent chunk_id and log for reconciliation"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}