only sort on pressure when serial provided

This commit is contained in:
xss 2023-01-18 11:33:57 +11:00
parent 7ba60bf4eb
commit 12296f1450

View File

@ -145,7 +145,7 @@ def get_telem(event, context):
"size": 10 if (duration == 0 ) else 1,
"sort": [
{"datetime": {"order": "desc"}},
{"pressure": {"order": "desc","mode" : "median"}}
],
}
}
@ -169,6 +169,7 @@ def get_telem(event, context):
}
if "queryStringParameters" in event:
if "serial" in event["queryStringParameters"]:
payload["aggs"]["2"]["aggs"]["3"]["aggs"]["1"]["top_hits"]["sort"].append({"pressure": {"order": "desc","mode" : "median"}})
payload["query"]["bool"]["filter"].append(
{
"match_phrase": {