Basic indexing + thumbnail is pretty much done

This commit is contained in:
simon987
2018-03-24 10:00:54 -04:00
parent a8b5e0b76e
commit d5189453e0
17 changed files with 198 additions and 287 deletions

View File

@@ -1,6 +1,7 @@
import elasticsearch
from elasticsearch import helpers
import requests
import json
class Search:
@@ -22,3 +23,27 @@ class Search:
"query": {"term": {"directory": dir_id}}},
index=self.index_name)
def get_index_size(self):
try:
info = requests.get("http://localhost:9200/" + self.index_name + "/_stats")
if info.status_code == 200:
parsed_info = json.loads(info.text)
return int(parsed_info["indices"][self.index_name]["primaries"]["store"]["size_in_bytes"])
except:
return 0
def get_doc_count(self):
try:
info = requests.get("http://localhost:9200/" + self.index_name + "/_stats")
if info.status_code == 200:
parsed_info = json.loads(info.text)
return int(parsed_info["indices"][self.index_name]["primaries"]["indexing"]["index_total"])
except:
return 0