Skip to content

Commit ef28d66

Browse files
Add logs get ES response when in case of assert error.
1 parent b58f840 commit ef28d66

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

biothings/web/query/formatter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ def __init__(self, *args, **kwargs):
8787
# make sure the document is coming from
8888
# elasticsearch at initialization time
8989
if "hits" not in self.data:
90+
logger.error("ES response missing 'hits' field. Response data: %s", self.data)
9091
raise ValueError("Response missing 'hits' field")
9192
if "total" not in self.data["hits"]:
93+
logger.error("ES response missing 'hits.total' field. Response data: %s", self.data)
9294
raise ValueError("Response missing 'hits.total' field")
9395
if "hits" not in self.data["hits"]:
96+
logger.error("ES response missing 'hits.hits' field. Response data: %s", self.data)
9497
raise ValueError("Response missing 'hits.hits' field")
9598
for hit in self.data["hits"]["hits"]:
9699
if "_source" not in hit:
100+
logger.error("ES hit missing '_source' field. Hit data: %s", hit)
97101
raise ValueError("Hit missing '_source' field")
98102

99103
class _Doc(Doc):

0 commit comments

Comments
 (0)