Can't delete data with python script


I am trying to make a script that deletes the old elasticsearch data. My problem is that in the read_only_allow_delete

In the code attached I try to put a put but it returns error 406.

Any ideas or solutions?

Thank you very much

if __name__ == '__main__':

es = Elasticsearch("http://.../")
res = requests.put(url= "... :9200/_settings" ,data= {"index": {"blocks": {"read_only_allow_delete": "false"}}})
#res = = "lab" , body= {"query": {"range": {"@timestamp": {"gte": "now-7d/d","lte": "now-7d/d"}}}})
res = es.delete_by_query(index = 'lab-benchmarking-csv' , body={"query": {"range": {"@timestamp": {"gte": "now-7d/d","lte": "now/d"}}}} , request_timeout=30)

Delete by query will do an update behind the scenes an at least temporarily increase disk usage. If you are suffering from high disk usage this way of removing data will not work.

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