From f52ae68389ffe5fa6ebded3e47123372354f5c9c Mon Sep 17 00:00:00 2001 From: Michaela Wheeler Date: Thu, 23 Dec 2021 07:14:29 +1100 Subject: [PATCH] missing size=0 likely causing more traffic from ES than required --- lambda/query/__init__.py | 2 ++ lambda/query/__main__.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lambda/query/__init__.py b/lambda/query/__init__.py index 77f2623..0c9e736 100644 --- a/lambda/query/__init__.py +++ b/lambda/query/__init__.py @@ -8,6 +8,7 @@ import es def get_sondes(event, context): path = "telm-*/_search" payload = { + "size": 0, "aggs": { "2": { "terms": { @@ -253,6 +254,7 @@ def get_listener_telemetry(event, context): path = "listeners-*/_search" payload = { + "size": 0, "timeout": "30s", "aggs": { "2": { diff --git a/lambda/query/__main__.py b/lambda/query/__main__.py index ab4d13e..d135995 100644 --- a/lambda/query/__main__.py +++ b/lambda/query/__main__.py @@ -1,6 +1,6 @@ from . import * -#print(get_sondes({"queryStringParameters":{"lat":"-32.7933","lon":"151.8358","distance":"5000", "last":"604800"}}, {})) +print(get_listener_telemetry({"queryStringParameters":{}}, {})) # mode: 6hours # type: positions # format: json @@ -20,16 +20,16 @@ from . import * # ) # ) # print(get_sites({},{})) -print( - get_telem( - { - "queryStringParameters": { - "duration": "1d", - # "serial": "S4430086" - }},{} +# print( +# get_telem( +# { +# "queryStringParameters": { +# "duration": "1d", +# # "serial": "S4430086" +# }},{} - ) - ) +# ) +# ) # print ( # get_chase( # {"queryStringParameters": {