mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-04 21:53:14 +08:00
fix:修复ES库无法使用向量检索.添加mappings创建向量索引
This commit is contained in:
parent
cb3822651b
commit
b2ea386f60
@ -38,7 +38,12 @@ class ESKBService(KBService):
|
|||||||
raise e
|
raise e
|
||||||
try:
|
try:
|
||||||
# 首先尝试通过es_client_python创建
|
# 首先尝试通过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:
|
except BadRequestError as e:
|
||||||
logger.error("创建索引失败,重新")
|
logger.error("创建索引失败,重新")
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user