Merge "Fix wrong package name for curator"
diff --git a/README.rst b/README.rst
index eb8a67b..a117a0b 100644
--- a/README.rst
+++ b/README.rst
@@ -192,6 +192,15 @@
                           type: keyword
                           ignore_above: 256
 
+Upgrade operations
+------------------
+
+Default elasticsearch client state can only create index temlates. To update exisiting ones according to pillar dedicated state should be run explicitly:
+
+.. code-block:: bash
+
+    salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.update_index_templates
+
 Read more
 =========
 
diff --git a/elasticsearch/client/update_index_templates.sls b/elasticsearch/client/update_index_templates.sls
new file mode 100644
index 0000000..88c8e64
--- /dev/null
+++ b/elasticsearch/client/update_index_templates.sls
@@ -0,0 +1,31 @@
+{%- from "elasticsearch/map.jinja" import client with context %}
+{%- if client.get('enabled', False) %}
+
+include:
+  - elasticsearch.client.service
+
+{%- for index_name, index in client.get('index', {}).iteritems() %}
+elasticsearch_index_template_upgrade_{{ index_name }}:
+
+  {%- if index.get('enabled', False) %}
+
+    {%- if index.definition is defined %}
+      {% set definition = index.definition %}
+    {%- endif %}
+    {%- if index.template is defined %}
+      {%- import_json index.template as definition %}
+    {%- endif %}
+
+    {%- if definition is defined %}
+  module.run:
+  - name: elasticsearch.index_template_create
+  - m_name: {{ index_name }}
+  - body: '{{ definition|json }}'
+  - require:
+    - pkg: elasticsearch_client_packages
+    {%- endif %}
+
+  {%- endif %}
+
+{%- endfor %}
+{%- endif %}
diff --git a/elasticsearch/files/v5/log4j2.properties b/elasticsearch/files/v5/log4j2.properties
index 16aee8d..3765907 100644
--- a/elasticsearch/files/v5/log4j2.properties
+++ b/elasticsearch/files/v5/log4j2.properties
@@ -14,7 +14,7 @@
 appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
 appender.rolling.layout.type = PatternLayout
 appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
-appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}.log
+appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}.log.gz
 appender.rolling.policies.type = Policies
 appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
 appender.rolling.policies.time.interval = 1
@@ -46,7 +46,7 @@
 appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog.log
 appender.index_search_slowlog_rolling.layout.type = PatternLayout
 appender.index_search_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
-appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog-%d{yyyy-MM-dd}.log
+appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_search_slowlog-%d{yyyy-MM-dd}.log.gz
 appender.index_search_slowlog_rolling.policies.type = Policies
 appender.index_search_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
 appender.index_search_slowlog_rolling.policies.time.interval = 1
@@ -62,7 +62,7 @@
 appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog.log
 appender.index_indexing_slowlog_rolling.layout.type = PatternLayout
 appender.index_indexing_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
-appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog-%d{yyyy-MM-dd}.log
+appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_index_indexing_slowlog-%d{yyyy-MM-dd}.log.gz
 appender.index_indexing_slowlog_rolling.policies.type = Policies
 appender.index_indexing_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
 appender.index_indexing_slowlog_rolling.policies.time.interval = 1