mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2024-12-18 20:57:56 +00:00
Fixes #112 - switched to terms and remove sondehubv1 filters
This commit is contained in:
parent
0663be8241
commit
76def2eada
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -524,14 +524,7 @@ async def predict_async(event, context):
|
||||
}
|
||||
}
|
||||
],
|
||||
"should": [],
|
||||
"must_not": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"software_name": "SondehubV1"
|
||||
}
|
||||
}
|
||||
]
|
||||
"should": []
|
||||
}
|
||||
},
|
||||
"size": 0
|
||||
|
@ -44,7 +44,7 @@ def query(event, context):
|
||||
"bool": {
|
||||
"filter": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"term": {
|
||||
"payload_callsign.keyword": payload_callsign
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ def fetch_es(serial, s3_data):
|
||||
"bool": {
|
||||
"filter": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"term": {
|
||||
"serial.keyword": serial
|
||||
}
|
||||
}
|
||||
|
@ -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"])
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -556,14 +556,7 @@ async def predict_async(event, context):
|
||||
}
|
||||
}
|
||||
],
|
||||
"should": [],
|
||||
"must_not": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"software_name": "SondehubV1"
|
||||
}
|
||||
}
|
||||
]
|
||||
"should": []
|
||||
}
|
||||
},
|
||||
"size": 0
|
||||
|
@ -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"])
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -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": {
|
||||
|
@ -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"])
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -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']))
|
||||
|
@ -30,7 +30,7 @@ def handler(event, context):
|
||||
},
|
||||
"query": {
|
||||
"bool": {
|
||||
"must_not": [{"match_phrase": {"serial": "xxxxxxxx"}}],
|
||||
"must_not": [{"term": {"serial": "xxxxxxxx"}}],
|
||||
"filter": [
|
||||
{
|
||||
"range": {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user