我是elasticsearch的新手,我想知道在预先形成查询时是否有办法包含或排除过滤器。这样我只编写一个查询而不是多个查询。
答案 0 :(得分:0)
是的,您可以使用shutil.rmtree
中的shutil.rmtree
标记来执行此操作。类似的东西:
import shutil
import os
import stat
def remove_readonly(func, path, excinfo):
os.chmod(path, stat.S_IWRITE)
func(path)
try:
#os.chmod is used to turn off Read-Only attribute
os.chmod("Q:/-----.vbs", stat.S_IWRITE)
#os.remove is used to remove individual files
os.remove("Q:/-----.vbs")
except:
pass
#shutil.rmtree is used to remove entire directories
#remove traces of file
try:
shutil.rmtree("Q:/FolderToRemove1", onerror=remove_readonly)
except:
pass
try:
shutil.rmtree("Q:/FolderToRemove2", onerror=remove_readonly)
except:
pass
try:
shutil.rmtree("Q:/FolderToRemove3", onerror=remove_readonly)
except:
pass
try:
shutil.rmtree("Q:/FolderToRemove4", onerror=remove_readonly)
except:
pass
try:
shutil.rmtree("Q:/FolderToRemove5", onerror=remove_readonly)
except:
pass
try:
shutil.rmtree("C:/Users/mhill/Desktop/screenshots", onerror=remove_readonly)
except:
pass
但是你可能也想看看post filtering。当您在filter
内外进行过滤时,性能可能会有所不同。这SO可能很方便。在结构化数据方面,您可以使用filter context。