|
|
|
@@ -322,12 +322,19 @@ class ESConnection(DocStoreConnection): |
|
|
|
# update specific single document |
|
|
|
chunkId = condition["id"] |
|
|
|
for i in range(ATTEMPT_TIME): |
|
|
|
for k in doc.keys(): |
|
|
|
if "feas" != k.split("_")[-1]: |
|
|
|
continue |
|
|
|
try: |
|
|
|
self.es.update(index=indexName, id=chunkId, script=f"ctx._source.remove(\"{k}\");") |
|
|
|
except Exception: |
|
|
|
logger.exception(f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception") |
|
|
|
try: |
|
|
|
self.es.update(index=indexName, id=chunkId, doc=doc) |
|
|
|
return True |
|
|
|
except Exception as e: |
|
|
|
logger.exception( |
|
|
|
f"ESConnection.update(index={indexName}, id={id}, doc={json.dumps(condition, ensure_ascii=False)}) got exception") |
|
|
|
f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception") |
|
|
|
if re.search(r"(timeout|connection)", str(e).lower()): |
|
|
|
continue |
|
|
|
break |