Add jre as extlisit requirement for elasticsearch

To avoid installation issue caused by
https://github.com/elastic/elasticsearch/issues/31845

Change-Id: I96ff31ac5a33225fa3c552d2208bf263bf3b95f6
Closes-Bug: PROD-25839
diff --git a/elasticsearch/map.jinja b/elasticsearch/map.jinja
index 93b3f07..0e5ae3c 100644
--- a/elasticsearch/map.jinja
+++ b/elasticsearch/map.jinja
@@ -2,6 +2,7 @@
 Debian:
   pkgs:
   - elasticsearch
+  dependency_pkgs:
   - default-jre-headless
   curator_pkgs:
   - elasticsearch-curator
@@ -10,6 +11,8 @@
 RedHat:
   pkgs:
   - elasticsearch
+  dependency_pkgs:
+  - java-1.8.0-openjdk-headless
   curator_pkgs:
   - elasticsearch-curator
   service: elasticsearch
diff --git a/elasticsearch/server/init.sls b/elasticsearch/server/init.sls
index 7995faf..e8ae754 100644
--- a/elasticsearch/server/init.sls
+++ b/elasticsearch/server/init.sls
@@ -6,9 +6,15 @@
   - elasticsearch.server.curator
 {%- endif %}
 
+elasticsearch_dependency_packages:
+  pkg.installed:
+  - names: {{ server.dependency_pkgs }}
+
 elasticsearch_packages:
   pkg.installed:
   - names: {{ server.pkgs }}
+  - require:
+    - pkg: elasticsearch_dependency_packages
 
 elasticsearch_default:
   file.managed: