Tencent/WeKnora · error
source chunk ID %s not found in mapping
Error message
source chunk ID %s not found in mapping
What it means
Elasticsearch v7 reindex mapping miss: the hit's source chunk_id is present but absent from the source-to-target chunk ID map built for this copy operation, so there is no destination to write the document to and the hit is rejected as unmappable.
Source
Thrown at internal/application/repository/retriever/elasticsearch/v7/repository.go:1178
// Get document source
sourceObj, ok := hitMap["_source"].(map[string]interface{})
if !ok {
log.Warnf("[ElasticsearchV7] Hit missing _source field")
return nil, nil, fmt.Errorf("hit missing _source field")
}
// Get source ChunkID and corresponding target ChunkID
sourceChunkID, ok := sourceObj["chunk_id"].(string)
if !ok {
log.Warnf("[ElasticsearchV7] Source index data missing chunk_id field")
return nil, nil, fmt.Errorf("source index data missing chunk_id field")
}
targetChunkID, ok := sourceToTargetChunkIDMap[sourceChunkID]
if !ok {
log.Warnf("[ElasticsearchV7] Source chunk ID %s not found in mapping", sourceChunkID)
return nil, nil, fmt.Errorf("source chunk ID %s not found in mapping", sourceChunkID)
}
// Get mapped target knowledge ID
sourceKnowledgeID, ok := sourceObj["knowledge_id"].(string)
if !ok {
log.Warnf("[ElasticsearchV7] Source index data missing knowledge_id field")
return nil, nil, fmt.Errorf("source index data missing knowledge_id field")
}
targetKnowledgeID, ok := sourceToTargetKBIDMap[sourceKnowledgeID]
if !ok {
log.Warnf("[ElasticsearchV7] Source knowledge ID %s not found in mapping", sourceKnowledgeID)
return nil, nil, fmt.Errorf("source knowledge ID %s not found in mapping", sourceKnowledgeID)
}
// Extract basic content
content, _ := sourceObj["content"].(string)
originalSourceID, _ := sourceObj["source_id"].(string)View on GitHub (pinned to 988cbb0330)
Solutions
- Ensure the copy mapping covers all chunks in the source index
- Check for newly created chunks after the mapping was built
- Skip unmapped hits and reconcile them in a follow-up pass
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/application/repository/retriever/elasticsearch/v7/repository.go:1178 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/1d89dc40c751e870.
Report an issue: GitHub.