diff --git a/salt/elasticsearch/template.map.jinja b/salt/elasticsearch/template.map.jinja index 7acb3eb87..72be1ec58 100644 --- a/salt/elasticsearch/template.map.jinja +++ b/salt/elasticsearch/template.map.jinja @@ -4,8 +4,11 @@ Elastic License 2.0. #} {% import_yaml 'elasticsearch/defaults.yaml' as ELASTICSEARCHDEFAULTS %} +{# ELASTICSEARCHMERGED only used here to collect data_retention_method. This file intentionally works with ELASTICSEARCHDEFAULTS #} +{% from 'elasticsearch/config.map.jinja' import ELASTICSEARCHMERGED %} + {% set DEFAULT_GLOBAL_OVERRIDES = ELASTICSEARCHDEFAULTS.elasticsearch.index_settings.pop('global_overrides') %} -{% set DATA_RETENTION_METHOD = salt['pillar.get']('elasticsearch:data_retention_method', ELASTICSEARCHDEFAULTS.elasticsearch.get('data_retention_method', 'ILM')) %} +{% set DATA_RETENTION_METHOD = ELASTICSEARCHMERGED.data_retention_method %} {% set PILLAR_GLOBAL_OVERRIDES = {} %} {% set ES_INDEX_PILLAR = salt['pillar.get']('elasticsearch:index_settings', {}) %} diff --git a/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-dlm-apply b/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-dlm-apply index af761973c..e25e07223 100644 --- a/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-dlm-apply +++ b/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-dlm-apply @@ -6,9 +6,8 @@ . /usr/sbin/so-common -{%- import_yaml 'elasticsearch/defaults.yaml' as ELASTICSEARCHDEFAULTS %} - -{%- set DATA_RETENTION_METHOD = salt['pillar.get']('elasticsearch:data_retention_method', ELASTICSEARCHDEFAULTS.elasticsearch.get('data_retention_method', 'ILM')) %} +{% from 'elasticsearch/config.map.jinja' import ELASTICSEARCHMERGED %} +{%- set DATA_RETENTION_METHOD = ELASTICSEARCHMERGED.data_retention_method %} ELASTICSEARCH_TEMPLATES_DIR="${ELASTICSEARCH_TEMPLATES_DIR:-/opt/so/conf/elasticsearch/templates}" TEMPLATE_DIRS=( diff --git a/salt/manager/tools/sbin/soup b/salt/manager/tools/sbin/soup index 0016cc00e..96313aea4 100755 --- a/salt/manager/tools/sbin/soup +++ b/salt/manager/tools/sbin/soup @@ -784,12 +784,13 @@ pin_elasticsearch_data_retention_method() { # Reference: https://github.com/elastic/kibana/issues/263048 kibana_backport_streams_index_template() { local current_template updated_template - current_template=$(so-elasticsearch-query "_index_template/.kibana_streams" --retry 3 --retry-delay 5 --fail) - if [[ -z "$current_template" ]]; then + set +e + if ! current_template=$(so-elasticsearch-query "_index_template/.kibana_streams" --retry 3 --retry-delay 5 --fail); then echo "Index template .kibana_streams does not exist, skipping backport." return 0 fi + set -e updated_template=$(jq '.index_templates[0].index_template | .template.settings += {"index.auto_expand_replicas": "0-1"} | del(.created_date_millis, .modified_date_millis)' <<< "$current_template")