permission entity tree list
This commit is contained in:
@@ -51,6 +51,14 @@ class ElasticHelper():
|
||||
self.id = ""
|
||||
|
||||
|
||||
def get_doctument(self, index_name, id):
|
||||
res = self.es.get(index=index_name, id=id)
|
||||
return res
|
||||
|
||||
def exist_doctument(self, index_name, id):
|
||||
res = self.es.exists(index=index_name, id=id)
|
||||
return res
|
||||
|
||||
def update_index_doc(self, is_update_state, index_name_o, eid, data):
|
||||
if is_update_state:
|
||||
resp = self.es.update(index=index_name_o, id=eid, doc=data)
|
||||
@@ -220,6 +228,24 @@ class ElasticHelper():
|
||||
self.createIndex(index_name, app_key, map_name)
|
||||
self.zipFileToElastic(file_path, index_name)
|
||||
|
||||
def restorFileToElastic2(self, path_file, index_name, app_key = '', queryDelete = True, map_name='') :
|
||||
if not os.path.exists(path_file) :
|
||||
print(' **** error *** path not exist: ', path_file)
|
||||
return False
|
||||
|
||||
file_path = path_file
|
||||
if not os.path.exists(file_path ) :
|
||||
return False
|
||||
|
||||
if queryDelete :
|
||||
# اگر وجود داشته باشد، از کاربر برای حذفش سوال میکند
|
||||
if self.deleteIndex(index_name) :
|
||||
self.createIndex(index_name, app_key, map_name)
|
||||
self.zipFileToElastic(file_path, index_name)
|
||||
else : # اگر وجود داشته باشد پرش می کند و کاری نمیکند
|
||||
self.createIndex(index_name, app_key, map_name)
|
||||
self.zipFileToElastic(file_path, index_name)
|
||||
|
||||
|
||||
def renameElasticIndex(self, index_name_i, index_name_o, app_key = '', map_name='') :
|
||||
|
||||
|
||||
Reference in New Issue
Block a user