diff --git a/ESConnect.py b/ESConnect.py index 470f354..bebfc5e 100644 --- a/ESConnect.py +++ b/ESConnect.py @@ -159,7 +159,7 @@ def update_by_id(doc_id, updated_data): """ try: # 执行更新操作 - es.update(index=index_name, id=doc_id, body={"doc": updated_data}) + es.update(index=data_index_name, id=doc_id, body={"doc": updated_data}) print(f"文档 {doc_id} 更新成功") return True except Exception as e: @@ -178,7 +178,7 @@ def get_by_id(doc_id): """ try: # 执行获取操作 - result = es.get(index=index_name, id=doc_id) + result = es.get(index=data_index_name, id=doc_id) if result['found']: return { "_id": result['_id'],