def log_tests(request):
es = get_elastic()
if not es:
return HttpResponse('not able to connect to elasticsearch')
res = es.search(index="message-log", doc_type='message', body={
"size": 0,
"aggs" : {
"test_ids" : {
"terms" : { "field" : "test_id", "size" : 500 }
}
}})
test_ids = []
for bucket in res['aggregations']['test_ids']['buckets']:
test_id = bucket['key']
test_ids.append({'id':'test_id_'+test_id, 'name':test_id})
context = {
'groups' : test_ids
}
template = loader.get_template('golem/log.html')
return HttpResponse(template.render(context,request))
评论列表
文章目录