From c4eb0fa862d6f3a655566d9866447f142577ed4e Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Wed, 8 Jan 2025 17:26:34 +0100 Subject: [PATCH] add mappings --- .../main/resources/agentless@mappings.json | 21 +++++++++++++++++++ .../main/resources/agentless@template.json | 1 + .../xpack/stack/StackTemplateRegistry.java | 8 +++++++ 3 files changed, 30 insertions(+) create mode 100644 x-pack/plugin/core/template-resources/src/main/resources/agentless@mappings.json diff --git a/x-pack/plugin/core/template-resources/src/main/resources/agentless@mappings.json b/x-pack/plugin/core/template-resources/src/main/resources/agentless@mappings.json new file mode 100644 index 0000000000000..36f20038d4004 --- /dev/null +++ b/x-pack/plugin/core/template-resources/src/main/resources/agentless@mappings.json @@ -0,0 +1,21 @@ +{ + "template": { + "mappings": { + "properties": { + "v": { + "type": "object", + "enabled": false + }, + "updated_at": { + "type": "date", + "format": "strict_date_optional_time||epoch_millis" + } + } + }, + "_meta": { + "description": "default mappings for the agentless index template installed by x-pack", + "managed": true + }, + "version": ${xpack.stack.template.version}, + "deprecated": ${xpack.stack.template.deprecated} +} diff --git a/x-pack/plugin/core/template-resources/src/main/resources/agentless@template.json b/x-pack/plugin/core/template-resources/src/main/resources/agentless@template.json index d7c06bb0911e9..35c5f5581b1e8 100644 --- a/x-pack/plugin/core/template-resources/src/main/resources/agentless@template.json +++ b/x-pack/plugin/core/template-resources/src/main/resources/agentless@template.json @@ -2,6 +2,7 @@ "index_patterns": ["agentless-*-*"], "priority": 100, "composed_of": [ + "agentless@mappings", "agentless@settings" ], "allow_auto_create": true, diff --git a/x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java b/x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java index 29fbe90f07566..da097593e9816 100644 --- a/x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java +++ b/x-pack/plugin/stack/src/main/java/org/elasticsearch/xpack/stack/StackTemplateRegistry.java @@ -102,6 +102,7 @@ public class StackTemplateRegistry extends IndexTemplateRegistry { ////////////////////////////////////////////////////////// // Agentless components (for matching agentless-*-* indices) ////////////////////////////////////////////////////////// + public static final String AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME = "agentless@mappings"; public static final String AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME = "agentless@settings"; public static final String AGENTLESS_INDEX_TEMPLATE_NAME = "agentless"; @@ -204,6 +205,13 @@ private Map loadComponentTemplateConfigs() { TEMPLATE_VERSION_VARIABLE, ADDITIONAL_TEMPLATE_VARIABLES ), + new IndexTemplateConfig( + AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME, + "/agentless@mappings.json", + REGISTRY_VERSION, + TEMPLATE_VERSION_VARIABLE, + ADDITIONAL_TEMPLATE_VARIABLES + ), new IndexTemplateConfig( AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME, "/agentless@settings.json",