At the outset ...... for various reasons, can not be used to install es python module, so the use of a stupid method for data deletion ......
ES data backup, migration, import can see the link: https://www.cnblogs.com/Huang-Niu/p/12598643.html
# ! / Usr / bin / env Python # - * - Coding: UTF-8 - * - "" " @Create Time: 2020/4/1 @file the Name: elasticsearch_del.py @author: Mr.yang @Python Version: 2.7 @Software: PyCharm "" " Import Time Import JSON Time = ' 2020-03-01 00:00:00 ' jsonfile = Open ( ' ./ back out of the index .json ' , ' R & lt ' ) File = Open ( ' ./ time is greater than the time .json ' , ' W ') notfile = open(' ./ .json timestamp without updating ' , ' W ' ) nonefile = Open ( ' ./ update timestamp to null .json ' , ' W ' ) DEF timestamp (Times): IF Not Times IS None: timems a float = (Times / 1000 ) time_local = time.localtime (timems) dt = The time.strftime ( " % D%% Y-M-% H:% M:% S " , time_local) IF dt> = Time: G = json.dumps(line) file.write(g) else: d = json.dumps(line) nonefile.write(d) for line in jsonfile: line = json.loads(line) s = line['_source'] if s.has_key('updateTime'): timestamp(s['updateTime']) else: n = json.dumps(line) notfile.write(n)