This commit is contained in:
2025-08-19 08:27:24 +08:00
parent 9ae7d6cf20
commit c23113a6f2

View File

@@ -42,11 +42,11 @@ def select_all_data(index_name):
print(f" 标签: {hit['_source'].get('tags', '')}")
print(f" 时间戳: {hit['_source'].get('timestamp', '')}")
# 在循环中添加打印完整数据结构的代码
if i == 1: # 只打印第一条数据的完整结构
print("完整数据结构:")
import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(hit['_source'])
# if i == 1: # 只打印第一条数据的完整结构
# print("完整数据结构:")
# import pprint
# pp = pprint.PrettyPrinter(indent=4)
# pp.pprint(hit['_source'])
print("-" * 50)
except Exception as e:
print(f"查询出错: {e}")