from elasticsearch import Elasticsearch import os, json, urllib, datetime, shutil,random,uuid import time import random from elasticsearch import helpers from random import choice if __name__ == '__main__': print("开始时间:"+time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))) es = Elasticsearch(hosts=["http://elastic:[email protected]:19200/"], timeout=30000) query = {'query': {'match': {'massive_type': '0'}}} es.delete_by_query(index='app_message_all', body=query, params={'scroll_size': '3000', 'slices': '2'}) print("结束时间:"+time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
slices:可以理解为并行度,开启几个进程去删除数据
scroll_size:批次大小标签:__,-%,random,python,time,import,query,delete From: https://www.cnblogs.com/hxlasky/p/17602383.html