add debugging for failing request

This commit is contained in:
Michaela Wheeler 2022-01-02 17:33:59 +11:00
parent 224ce5c792
commit 30f1cea3de

View File

@ -67,8 +67,11 @@ def get_sondes(event, context):
payload["query"]["bool"]["filter"].append( payload["query"]["bool"]["filter"].append(
{"range": {"datetime": {"gte": "now-1d", "lte": "now+1m"}}} {"range": {"datetime": {"gte": "now-1d", "lte": "now+1m"}}}
) )
try:
results = es.request(json.dumps(payload), path, "POST") results = es.request(json.dumps(payload), path, "POST")
except:
print(json.dumps(event))
raise
buckets = results["aggregations"]["2"]["buckets"] buckets = results["aggregations"]["2"]["buckets"]
sondes = { sondes = {
bucket["1"]["hits"]["hits"][0]["_source"]["serial"]: bucket["1"]["hits"][ bucket["1"]["hits"]["hits"][0]["_source"]["serial"]: bucket["1"]["hits"][