mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 00:58:58 +08:00
Regards kb_id at ElasticSearch insert, update, delete. (#6105)
### What problem does this PR solve? Regards kb_id at ElasticSearch insert, update, delete. Close #6066 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
485bc7d7d6
commit
4fffee6695
@ -284,6 +284,7 @@ class ESConnection(DocStoreConnection):
|
|||||||
assert "_id" not in d
|
assert "_id" not in d
|
||||||
assert "id" in d
|
assert "id" in d
|
||||||
d_copy = copy.deepcopy(d)
|
d_copy = copy.deepcopy(d)
|
||||||
|
d_copy["kb_id"] = knowledgebaseId
|
||||||
meta_id = d_copy.pop("id", "")
|
meta_id = d_copy.pop("id", "")
|
||||||
operations.append(
|
operations.append(
|
||||||
{"index": {"_index": indexName, "_id": meta_id}})
|
{"index": {"_index": indexName, "_id": meta_id}})
|
||||||
@ -316,6 +317,7 @@ class ESConnection(DocStoreConnection):
|
|||||||
def update(self, condition: dict, newValue: dict, indexName: str, knowledgebaseId: str) -> bool:
|
def update(self, condition: dict, newValue: dict, indexName: str, knowledgebaseId: str) -> bool:
|
||||||
doc = copy.deepcopy(newValue)
|
doc = copy.deepcopy(newValue)
|
||||||
doc.pop("id", None)
|
doc.pop("id", None)
|
||||||
|
condition["kb_id"] = knowledgebaseId
|
||||||
if "id" in condition and isinstance(condition["id"], str):
|
if "id" in condition and isinstance(condition["id"], str):
|
||||||
# update specific single document
|
# update specific single document
|
||||||
chunkId = condition["id"]
|
chunkId = condition["id"]
|
||||||
@ -399,6 +401,7 @@ class ESConnection(DocStoreConnection):
|
|||||||
def delete(self, condition: dict, indexName: str, knowledgebaseId: str) -> int:
|
def delete(self, condition: dict, indexName: str, knowledgebaseId: str) -> int:
|
||||||
qry = None
|
qry = None
|
||||||
assert "_id" not in condition
|
assert "_id" not in condition
|
||||||
|
condition["kb_id"] = knowledgebaseId
|
||||||
if "id" in condition:
|
if "id" in condition:
|
||||||
chunk_ids = condition["id"]
|
chunk_ids = condition["id"]
|
||||||
if not isinstance(chunk_ids, list):
|
if not isinstance(chunk_ids, list):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user