Skip to content

Commit

Permalink
Get aggregations for all the municipalities.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyten committed Sep 18, 2024
1 parent 12e6f37 commit f1c9a5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,13 @@ def es_monthly_check(token):
lines = []
for idx, total in result.items():
if total < 20:
muni = ' '.join(idx.split('_')[1:-1])
muni = ' '.join([i for i in idx.split('_')[1:-1] if i != 'fixed'])
lines.append(
"%s heeft %d documenten erbij in de afgelopen maand" % (muni, total,))
#print(lines)
if len(lines) > 0:
payload = {
"title":"Found a bug",
"title":"Possible fetch problems this month ..."
"body":"\n".join(lines),
"assignees":[
"breyten"],
Expand Down
4 changes: 3 additions & 1 deletion ocd_backend/utils/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def get_recent_counts():
"aggs": {
"index": {
"terms": {
"field": "_index"
"field": "_index",
"size": 10000
}
}
},
"size": 0
}
resp = es.search(body=payload)
#print(resp)
indices = get_indices()
result = {i: 0 for i in indices}
for b in resp.get('aggregations', {}).get('index', {}).get('buckets', []):
Expand Down

0 comments on commit f1c9a5c

Please sign in to comment.