From 3a22a0802999b31a9474c96a3f1c25b66892585c Mon Sep 17 00:00:00 2001 From: Eric Beahan Date: Tue, 8 Dec 2020 16:24:37 -0600 Subject: [PATCH] [1.x] Handle `error.stack_trace` case for ES 6.x template (#1176) (#1177) --- CHANGELOG.next.md | 2 +- scripts/generators/es_template.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.md b/CHANGELOG.next.md index 2488a956e5..641bbd272d 100644 --- a/CHANGELOG.next.md +++ b/CHANGELOG.next.md @@ -51,7 +51,7 @@ Thanks, you're awesome :-) --> * Added a notice highlighting that the `tracing` fields are not nested under the namespace `tracing.` #1162 -* ES 6.x template data types will fallback to supported types. #1171 +* ES 6.x template data types will fallback to supported types. #1171, #1176 #### Deprecated diff --git a/scripts/generators/es_template.py b/scripts/generators/es_template.py index bb56356a5a..65dc871a2e 100644 --- a/scripts/generators/es_template.py +++ b/scripts/generators/es_template.py @@ -97,6 +97,13 @@ def generate_template_version(elasticsearch_version, mappings_section, out_dir, if elasticsearch_version == 6: es6_mappings_section = copy.deepcopy(mappings_section) es6_type_fallback(es6_mappings_section['properties']) + + # error.stack_trace needs special handling to set + # index: false and doc_values: false + error_stack_trace_mappings = es6_mappings_section['properties']['error']['properties']['stack_trace'] + error_stack_trace_mappings.setdefault('index', False) + error_stack_trace_mappings.setdefault('doc_values', False) + template['mappings'] = {'_doc': es6_mappings_section} else: template['mappings'] = mappings_section