diff --git a/lambda/ham_predict/__init__.py b/lambda/ham_predict/__init__.py index 435259e..06b7733 100644 --- a/lambda/ham_predict/__init__.py +++ b/lambda/ham_predict/__init__.py @@ -78,7 +78,7 @@ def predict(event, context): for payload_callsign in event["queryStringParameters"]["vehicles"].split(","): payload["query"]["bool"]["should"].append( { - "match_phrase": { + "term": { "payload_callsign.keyword": payload_callsign } } diff --git a/lambda/ham_predict_updater/__init__.py b/lambda/ham_predict_updater/__init__.py index fe3c372..272955e 100644 --- a/lambda/ham_predict_updater/__init__.py +++ b/lambda/ham_predict_updater/__init__.py @@ -524,14 +524,7 @@ async def predict_async(event, context): } } ], - "should": [], - "must_not": [ - { - "match_phrase": { - "software_name": "SondehubV1" - } - } - ] + "should": [] } }, "size": 0 diff --git a/lambda/ham_update_flight_doc/__init__.py b/lambda/ham_update_flight_doc/__init__.py index 0333c87..40fc703 100644 --- a/lambda/ham_update_flight_doc/__init__.py +++ b/lambda/ham_update_flight_doc/__init__.py @@ -44,7 +44,7 @@ def query(event, context): "bool": { "filter": [ { - "match_phrase": { + "term": { "payload_callsign.keyword": payload_callsign } } diff --git a/lambda/historic_es_to_s3/__init__.py b/lambda/historic_es_to_s3/__init__.py index 3b398a4..eba17b1 100644 --- a/lambda/historic_es_to_s3/__init__.py +++ b/lambda/historic_es_to_s3/__init__.py @@ -24,7 +24,7 @@ def fetch_es(serial, s3_data): "bool": { "filter": [ { - "match_phrase": { + "term": { "serial.keyword": serial } } diff --git a/lambda/history/__init__.py b/lambda/history/__init__.py index c89bfc4..7205ed8 100644 --- a/lambda/history/__init__.py +++ b/lambda/history/__init__.py @@ -49,8 +49,8 @@ def history(event, context): "filter": [ {"match_all": {}}, { - "match_phrase": { - "serial": str(event["pathParameters"]["serial"]) + "term": { + "serial.keyword": str(event["pathParameters"]["serial"]) } } ] diff --git a/lambda/predict/__init__.py b/lambda/predict/__init__.py index 95320d7..3b39bd0 100644 --- a/lambda/predict/__init__.py +++ b/lambda/predict/__init__.py @@ -78,7 +78,7 @@ def predict(event, context): for serial in event["queryStringParameters"]["vehicles"].split(","): payload["query"]["bool"]["should"].append( { - "match_phrase": { + "term": { "serial.keyword": serial } } diff --git a/lambda/predict_updater/__init__.py b/lambda/predict_updater/__init__.py index a5a0c89..ba3bad4 100644 --- a/lambda/predict_updater/__init__.py +++ b/lambda/predict_updater/__init__.py @@ -556,14 +556,7 @@ async def predict_async(event, context): } } ], - "should": [], - "must_not": [ - { - "match_phrase": { - "software_name": "SondehubV1" - } - } - ] + "should": [] } }, "size": 0 diff --git a/lambda/query/__init__.py b/lambda/query/__init__.py index 014e983..3cf7dc8 100644 --- a/lambda/query/__init__.py +++ b/lambda/query/__init__.py @@ -172,8 +172,8 @@ def get_telem(event, context): payload["aggs"]["2"]["aggs"]["3"]["aggs"]["1"]["top_hits"]["sort"].append({"pressure": {"order": "desc","mode" : "median"}}) payload["query"]["bool"]["filter"].append( { - "match_phrase": { - "serial": str(event["queryStringParameters"]["serial"]) + "term": { + "serial.keyword": str(event["queryStringParameters"]["serial"]) } } ) @@ -302,8 +302,8 @@ def get_listener_telemetry(event, context): if "uploader_callsign" in event["queryStringParameters"]: payload["query"]["bool"]["filter"].append( { - "match_phrase": { - "uploader_callsign": str(event["queryStringParameters"]["uploader_callsign"]) + "term": { + "uploader_callsign.keyword": str(event["queryStringParameters"]["uploader_callsign"]) } } ) @@ -374,8 +374,8 @@ def get_sites(event, context): if "station" in event["queryStringParameters"]: payload["query"]["bool"]["filter"].append( { - "match_phrase": { - "station": str(event["queryStringParameters"]["station"]) + "term": { + "station.keyword": str(event["queryStringParameters"]["station"]) } } ) diff --git a/lambda/query/__main__.py b/lambda/query/__main__.py index 3cec088..2a61301 100644 --- a/lambda/query/__main__.py +++ b/lambda/query/__main__.py @@ -62,16 +62,15 @@ from . import * # {}, # ) # ) -print(get_sites({},{})) +# print(get_sites({"queryStringParameters":{"station":-1}},{})) -# a=get_telem( -# { -# "queryStringParameters": { -# "duration": "3h", -# # "serial": "S4430086" -# }},{} - -# ) +print(get_telem( + { + "queryStringParameters": { + "duration": "3h", + # "serial": "S4430086" + }},{} +)) # b=get_telem( # { # "queryStringParameters": { diff --git a/lambda/query_ham/__init__.py b/lambda/query_ham/__init__.py index 80acdcf..09ef45e 100644 --- a/lambda/query_ham/__init__.py +++ b/lambda/query_ham/__init__.py @@ -170,7 +170,7 @@ def get_telem(event, context): "query": { "bool": { "minimum_should_match": 1, - "must_not": [{"match_phrase": {"software_name": "SondehubV1"}}, {"match_phrase": {"payload_callsign": "xxxxxxxx"}}], + "must_not": [{"term": {"payload_callsign.keyword": "xxxxxxxx"}}], "should": [ { "bool": { @@ -219,7 +219,7 @@ def get_telem(event, context): payloads = str(event["queryStringParameters"]["payload_callsign"]).split(",") payload["query"]["bool"]["must"] = { "bool": { - "should": [ {"match_phrase": {"payload_callsign": x}} for x in payloads ] + "should": [ {"term": {"payload_callsign.keyword": x}} for x in payloads ] } } results = es.request(json.dumps(payload), path, "POST") @@ -287,7 +287,7 @@ def get_telem_full(event, context): "query": { "bool": { "minimum_should_match": 1, - "must_not": [{"match_phrase": {"software_name": "SondehubV1"}}, {"match_phrase": {"payload_callsign": "xxxxxxxx"}}], + "must_not": [ {"term": {"payload_callsign.keyword": "xxxxxxxx"}}], "should": [ { "bool": { @@ -333,8 +333,8 @@ def get_telem_full(event, context): } payload["query"]["bool"]["filter"].append( { - "match_phrase": { - "payload_callsign": str(event["pathParameters"]["payload_callsign"]) + "term": { + "payload_callsign.keyword": str(event["pathParameters"]["payload_callsign"]) } } ) @@ -578,8 +578,8 @@ def get_listener_telemetry(event, context): if "uploader_callsign" in event["queryStringParameters"]: payload["query"]["bool"]["filter"].append( { - "match_phrase": { - "uploader_callsign": str(event["queryStringParameters"]["uploader_callsign"]) + "term": { + "uploader_callsign.keyword": str(event["queryStringParameters"]["uploader_callsign"]) } } ) diff --git a/lambda/query_ham/__main__.py b/lambda/query_ham/__main__.py index c380f65..db125dd 100644 --- a/lambda/query_ham/__main__.py +++ b/lambda/query_ham/__main__.py @@ -3,17 +3,17 @@ import base64 import zlib -response = get_telem( +response = get_telem_full( { "pathParameters": { - + "payload_callsign": "PD3EGE" }, "queryStringParameters":{ # "payload_callsign" : "NOB14,VE6AGD-11", - # "last": "10800", - # "datetime": "2022-06-26T08:30:00.000001Z", + "last": "22269", + "datetime": "1688655220.471", # "format": "kml" - "duration": "732d" + #"duration": "732d" } }, {}) print(len(response['body'])) diff --git a/lambda/queue_data_update/__init__.py b/lambda/queue_data_update/__init__.py index e7d2de5..5756ed7 100644 --- a/lambda/queue_data_update/__init__.py +++ b/lambda/queue_data_update/__init__.py @@ -30,7 +30,7 @@ def handler(event, context): }, "query": { "bool": { - "must_not": [{"match_phrase": {"serial": "xxxxxxxx"}}], + "must_not": [{"term": {"serial": "xxxxxxxx"}}], "filter": [ { "range": { diff --git a/lambda/recovered/__init__.py b/lambda/recovered/__init__.py index 397ae21..f5486eb 100644 --- a/lambda/recovered/__init__.py +++ b/lambda/recovered/__init__.py @@ -36,7 +36,7 @@ def sondeExists(serial): "bool": { "filter": [ { - "match_phrase": { + "term": { "serial.keyword": serial } } @@ -88,13 +88,13 @@ def getRecovered(serial): "bool": { "filter": [ { - "match_phrase": { + "term": { "serial.keyword": serial } }, { - "match_phrase": { - "recovered": True + "term": { + "recovered.keyword": True # not sure if this right? should be a bool time. function is never called though } }, ] @@ -182,7 +182,7 @@ def get(event, context): for serial in serials: should.append( { - "match_phrase": { + "term": { "serial.keyword": serial } } diff --git a/lambda/reverse_predict/__init__.py b/lambda/reverse_predict/__init__.py index 4773e40..3243e93 100644 --- a/lambda/reverse_predict/__init__.py +++ b/lambda/reverse_predict/__init__.py @@ -113,7 +113,7 @@ def predict(event, context): for serial in event["queryStringParameters"]["vehicles"].split(","): payload["query"]["bool"]["should"].append( { - "match_phrase": { + "term": { "serial.keyword": serial } }