mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2025-04-08 03:24:13 +00:00
Closes #71
This commit is contained in:
parent
1c69db36ff
commit
069326b983
@ -338,10 +338,28 @@ def get_sites(event, context):
|
||||
path = "sites/_search"
|
||||
payload = {
|
||||
"version": True,
|
||||
"size": 10000,
|
||||
"size": 0,
|
||||
"_source": {
|
||||
"excludes": []
|
||||
},
|
||||
"aggs": {
|
||||
"2": {
|
||||
"terms": {
|
||||
"field": "station.keyword",
|
||||
"order": {"_key": "desc"},
|
||||
"size": 10000,
|
||||
},
|
||||
|
||||
"aggs": {
|
||||
"1": {
|
||||
"top_hits": {
|
||||
"size": 1,
|
||||
"sort": [{"datetime": {"order": "desc"}}],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
@ -362,7 +380,7 @@ def get_sites(event, context):
|
||||
}
|
||||
)
|
||||
results = es.request(json.dumps(payload), path, "POST")
|
||||
output = {x['_source']['station']: x['_source'] for x in results['hits']['hits']}
|
||||
output = {x['1']['hits']['hits'][0]['_source']['station']: x['1']['hits']['hits'][0]['_source'] for x in results['aggregations']['2']['buckets']}
|
||||
|
||||
compressed = BytesIO()
|
||||
with gzip.GzipFile(fileobj=compressed, mode='w') as f:
|
||||
|
@ -62,24 +62,24 @@ from . import *
|
||||
# {},
|
||||
# )
|
||||
# )
|
||||
# print(get_sites({},{}))
|
||||
print(get_sites({},{}))
|
||||
|
||||
a=get_telem(
|
||||
{
|
||||
"queryStringParameters": {
|
||||
"duration": "3h",
|
||||
# "serial": "S4430086"
|
||||
}},{}
|
||||
# a=get_telem(
|
||||
# {
|
||||
# "queryStringParameters": {
|
||||
# "duration": "3h",
|
||||
# # "serial": "S4430086"
|
||||
# }},{}
|
||||
|
||||
)
|
||||
b=get_telem(
|
||||
{
|
||||
"queryStringParameters": {
|
||||
"duration": "3h",
|
||||
"serial": "5C3A7D72"
|
||||
}},{}
|
||||
# )
|
||||
# b=get_telem(
|
||||
# {
|
||||
# "queryStringParameters": {
|
||||
# "duration": "3h",
|
||||
# "serial": "5C3A7D72"
|
||||
# }},{}
|
||||
|
||||
)
|
||||
# )
|
||||
# print (
|
||||
# get_chase(
|
||||
# {"queryStringParameters": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user