Homepage stats now work with elasticsearch

This commit is contained in:
Simon
2018-06-12 23:19:57 -04:00
parent 2fe81e4b06
commit e91572a06f
4 changed files with 12 additions and 8 deletions

View File

@@ -222,10 +222,15 @@ class ElasticSearchEngine(SearchEngine):
},
"aggs": {
"total_size": {
"extended_stats": {"field": "size"}
"sum": {"field": "size"}
}
},
"size": 0
})
}, index=self.index_name)
stats = dict()
stats["file_count"] = result["hits"]["total"]
stats["file_size"] = result["aggregations"]["total_size"]["value"]
return stats
print(result)