Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:修复ES库无法向量检索.添加mappings创建向量索引 #2688

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion server/knowledge_base/kb_service/es_kb_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ def do_init(self):
raise e
try:
# 首先尝试通过es_client_python创建
self.es_client_python.indices.create(index=self.index_name)
mappings = {
"dense_vector": {
"type": "dense_vector"
}
}
self.es_client_python.indices.create(index=self.index_name, mappings=mappings)
except BadRequestError as e:
logger.error("创建索引失败,重新")
logger.error(e)
Expand Down