Delete data in Elasticsearch(6.4.1) cluster is very slow


(Chunbo Liao) #1

Hi,

I used python script to delete the data in Elasticsearch cluster(5 nodes). the speed is very slow, only 5K/s.
my script code is:

#!/usr/bin/python
from elasticsearch import Elasticsearch
import sys
import time

class ElasticSearchClient(object):
@staticmethod
def get_es_servers():
es_servers = [{
"host": "localhost",
"port": "9200"
}]
es_client = Elasticsearch(hosts=es_servers)
return es_client

class LoadElasticSearch(object):
def init(self):
self.index = "logmonster"
self.es_client = ElasticSearchClient.get_es_servers()

def delete_by_casename(self, caseName):
    query = {"query":{"match": {"CaseName": {"query":'"'+caseName+'"',"operator": "and"}}}}
    return self.es_client.delete_by_query(index='logmonster',body=query,conflicts='proceed',request_timeout=500)

def main(self):
    result = self.delete_by_case_mme(CASE_NAME, MME_NAME)
    print(result)

if name == 'main':
load_es = LoadElasticSearch()
load_es.main()

what can I do so that I can promote the delete speed?

BR
Liao Chunbo


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.