How to Fix Knowledge Base Vector Search After Upgrading Dify

How to Fix Knowledge Base Vector Search After Upgrading Dify | Dify 升级后知识库向量检索报错的修复方法


Problem | 问题

After upgrading Dify (e.g., from 1.8.x/1.10.x to 1.11.0+), you may encounter this error when testing knowledge base retrieval:

升级 Dify(例如从 1.8.x/1.10.x 升级到 1.11.0+)后,测试知识库检索时可能遇到以下错误:

Query call with protocol GRPC search failed with message extract target vectors: class 
Vector_index_xxx_Node does not have named vector default configured. 
Available named vectors map[].


Root Cause | 根本原因

English: This is caused by a Weaviate schema format change. Old knowledge bases use vectorIndexConfig at the top level, but newer Dify versions expect vectorConfig.default. This mismatch breaks vector search.

中文: 这是由 Weaviate schema 格式变更引起的。旧知识库在顶层使用 vectorIndexConfig,但新版 Dify 期望 vectorConfig.default 格式。这种不匹配导致向量搜索失败。


Solution | 解决方案

I’ve created a Python script to batch fix this issue:

我创建了一个 Python 脚本来批量修复此问题:

:link: GitHub Repository | 仓库地址


Quick Start | 快速开始

Step 1: Download and copy script | 下载并复制脚本

# Download | 下载
curl -o /tmp/batch_fix_weaviate.py https://raw.githubusercontent.com/yupoet/dify-weaviate-fix/main/batch_fix_weaviate.py

# Copy to container | 复制到容器
docker cp /tmp/batch_fix_weaviate.py docker-api-1:/tmp/

Step 2: Scan affected collections | 扫描受影响的 collections

docker exec docker-api-1 python /tmp/batch_fix_weaviate.py scan

Step 3: Fix all affected collections | 修复所有受影响的 collections

docker exec -it docker-api-1 python /tmp/batch_fix_weaviate.py fix

Step 4: Re-embed in Dify | 在 Dify 中重新嵌入

English: For each affected knowledge base, go to Settings → Embedding Model, switch to a different model, save, then switch back and save again. This forces re-embedding.

中文: 对每个受影响的知识库,进入 设置 → Embedding 模型,切换到另一个模型并保存,然后切换回原模型再保存。这会强制重新嵌入。


Available Commands | 可用命令

Command Description 说明
scan List collections needing fix 列出需要修复的 collections
dry-run Simulate fix (no changes) 模拟修复(不实际执行)
fix Fix all affected collections 修复所有受影响的 collections
fix-one <name> Fix single collection 修复单个 collection
cleanup Remove orphaned collections 删除孤立的 collections
list-names Show dataset names 显示知识库名称

Environment Variables | 环境变量

Variable Default Description 说明
WEAVIATE_ENDPOINT http://weaviate:8080 Weaviate URL Weaviate 地址
WEAVIATE_API_KEY (empty) API key API 密钥

Tested With | 测试环境

  • Dify 1.11.0

  • Weaviate 1.27.0


Full Documentation | 完整文档


If this helped you, please :star: the repository!

如果对你有帮助,请给仓库点个 :star:

GitHub: GitHub - yupoet/dify-weaviate-fix: How to Fix Knowledge Base Vector Search After Upgrading Dify (Weaviate vectorConfig Issue)

There is already an official migration guide and a migration script available for this issue.

Additionally, a simplified community-based Gist of the official migration guide has also been made available.

Thanks for sharing the official resources! I’ve reviewed them carefully.

Clarification on the difference:

Official Solution My Solution
Approach Migrate data (preserve vectors) Rebuild schema + re-embed
Preserves vectors :white_check_mark: Yes :cross_mark: No, requires re-embedding
Best for Large datasets Small datasets or when switching embedding models anyway
Complexity Higher (LSM fix + data migration) Lower (just schema recreation)

My solution is intended as a quick fix for:

  • Small deployments with few knowledge bases
  • Users who want to switch embedding models anyway
  • Situations where re-embedding is acceptable

The official solution is better for:

  • Large deployments with many documents
  • Users who want to preserve existing vectors
  • Production environments where re-embedding would take too long

I’ll update my GitHub repo to clarify this positioning and add references to the official guide. Thanks for the feedback! :folded_hands:


感谢分享官方资源!我仔细查看了这些文档。

关于两种方案的区别说明:

我的方案定位是一个快速简化修复,适用于:

  • 知识库数量较少的小型部署
  • 本来就想切换 embedding 模型的用户
  • 可以接受重新嵌入的场景

官方方案更适合:

  • 文档量大的大型部署
  • 需要保留现有向量数据的用户
  • 重新嵌入耗时过长的生产环境

我会更新 GitHub 仓库,明确方案定位并添加官方指南的引用。感谢反馈!:folded_hands: