mirror of
https://github.com/simon987/od-database.git
synced 2025-12-16 16:19:05 +00:00
Homepage stats now work with elasticsearch
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user