pass time_zone to daily aggs

This commit is contained in:
Simon
2023-11-09 10:34:08 +07:00
parent 04124e3dad
commit 8b1324139d

View File

@@ -2,6 +2,7 @@
from home.src.es.connect import ElasticWrap
from home.src.ta.helper import get_duration_str
from home.src.ta.settings import EnvironmentSettings
class AggBase:
@@ -168,6 +169,7 @@ class DownloadHist(AggBase):
"calendar_interval": "day",
"format": "yyyy-MM-dd",
"order": {"_key": "desc"},
"time_zone": EnvironmentSettings.TZ,
},
"aggs": {
"total_videos": {"value_count": {"field": "youtube_id"}},
@@ -175,7 +177,14 @@ class DownloadHist(AggBase):
},
}
},
"query": {"range": {"date_downloaded": {"gte": "now-7d/d"}}},
"query": {
"range": {
"date_downloaded": {
"gte": "now-7d/d",
"time_zone": EnvironmentSettings.TZ,
}
}
},
}
def process(self):