From 35da079da8cadc54896e1ce2f42e278c4a802052 Mon Sep 17 00:00:00 2001
From: SMY ALTAMASH <30286162+SMYALTAMASH@users.noreply.github.com>
Date: Wed, 17 Jul 2019 18:05:35 +0530
Subject: [PATCH] Script to get ES data for all the indices in our env (#645)

* Script to add ES data
---
 deploy/utilities/getEsData.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 deploy/utilities/getEsData.sh

diff --git a/deploy/utilities/getEsData.sh b/deploy/utilities/getEsData.sh
new file mode 100644
index 000000000..48041b284
--- /dev/null
+++ b/deploy/utilities/getEsData.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+####################################################
+#  Author S M Y ALTAMASH <smy.altamash@gmail.com>  #
+# Script gets the Latest Logs of proxy from Log-es #
+####################################################
+# NOTE: Have jq installed before running this script
+for index in $(curl -s localhost:9200/_cat/indices | grep -v kibana | awk '{print $3}' | tr "\n" " ");
+do
+        echo "Index:$index"
+        # Get the Total Hits for the Proxy Container
+        hits=$(curl -s -X GET "http://localhost:9200/$index/_search?pretty" -H 'Content-Type: application/json' -d'{"query":{"match":{"program":"proxy_proxy*"}}}' | jq '.hits.total')
+
+        # Increase the query size
+        curl -XPUT "http://localhost:9200/$index/_settings" -d "{ \"index\" : { \"max_result_window\" : \"$hits\" } }" -H "Content-Type: application/json"
+
+        # Save the Logs in the file
+        curl -s -X GET "http://localhost:9200/$index/_search?size=$hits" -H 'Content-Type: application/json' -d'{"query":{"match":{"program":"proxy_proxy*"}}}' > $index.json
+        echo "################################"
+done
+
-- 
GitLab