Skip to content

Commit

Permalink
Merge pull request #2688 from MSZheng20/dev
Browse files Browse the repository at this point in the history
fix:修复ES库无法向量检索.添加mappings创建向量索引
  • Loading branch information
zRzRzRzRzRzRzR committed Jan 17, 2024
2 parents 1b5efec + b2ea386 commit e5acf3d
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit e5acf3d

Please sign in to comment.