From 07f1c4297d908c4fcd0d5361fae1295bf957b9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 13 Jun 2019 00:14:32 -0400 Subject: [PATCH] if there's nothing to delete dont delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- elasticsearch/esclean.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/esclean.py b/elasticsearch/esclean.py index 257719d..7a51988 100755 --- a/elasticsearch/esclean.py +++ b/elasticsearch/esclean.py @@ -73,7 +73,7 @@ def main(): if opts.query > 0: resp = es.search(index=index, body=body) print_logs(resp['hits']['hits']) - elif opts.delete: + elif opts.delete and count > 0: rval = es.delete_by_query(index=index, body=body) rval2 = es.indices.forcemerge( index=index,