I am getting below error while trying to delete the data of an Index in ES which I am not able to resolve.
code snippet:
from elasticsearch import Elasticsearch
ES_HOST = {"host" : "localhost", "port" : 9200}
start_datetime = "2020-12-23 00:00:00"
end_datetime = "2020-12-24 00:00:00"
es = Elasticsearch(hosts = [ES_HOST])
es.delete_by_query(index = INDEX_NAME, body = {
"query": {
"bool": {
"should": [{
"range": {
"recorddate": {
"gte": str(start_datetime),
"lt": str(end_datetime)
}
}
}]
}
}
})
elasticsearch.exceptions.ConflictError: ConflictError(409, u'{"took":719,"timed_out":false,"total":527871,"deleted":0,"batches":1,"version_conflicts":1000,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
ES Document reference : https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
Other references used for using in python : https://python.hotexamples.com/examples/elasticsearch/Elasticsearch/delete_by_query/python-elasticsearch-delete_by_query-method-examples.html