Skip to content

Commit 3d71b3f

Browse files
committed
Move Watcher versioning setting to meta field (#30832)
The .watcher-history-* template is currently using a plugin-custom index setting xpack.watcher.template.version, which prevents this template from being installed in a mixed OSS / X-Pack cluster, ultimately leading to the situation where an X-Pack node is constantly spamming an OSS master with (failed) template updates. Other X-Pack templates (e.g. security-index-template or security_audit_log) achieve the same versioning functionality by using a custom _meta field in the mapping instead. This commit switches the .watcher-history-* template to use the _meta field instead.
1 parent 3d97354 commit 3d71b3f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

x-pack/plugin/core/src/main/resources/watch-history.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
"index_patterns": [ ".watcher-history-${xpack.watcher.template.version}*" ],
33
"order": 2147483647,
44
"settings": {
5-
"xpack.watcher.template.version": "${xpack.watcher.template.version}",
65
"index.number_of_shards": 1,
76
"index.number_of_replicas": 0,
87
"index.auto_expand_replicas": "0-1",
98
"index.format": 6
109
},
1110
"mappings": {
1211
"doc": {
12+
"_meta": {
13+
"watcher-history-version": "${xpack.watcher.template.version}"
14+
},
1315
"dynamic_templates": [
1416
{
1517
"disabled_payload_fields": {

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@
198198

199199
public class Watcher extends Plugin implements ActionPlugin, ScriptPlugin {
200200

201+
// This setting is only here for backward compatibility reasons as 6.x indices made use of it. It can be removed in 8.x.
202+
@Deprecated
201203
public static final Setting<String> INDEX_WATCHER_TEMPLATE_VERSION_SETTING =
202204
new Setting<>("index.xpack.watcher.template.version", "", Function.identity(), Setting.Property.IndexScope);
203205
public static final Setting<Boolean> ENCRYPT_SENSITIVE_DATA_SETTING =

0 commit comments

Comments
 (0)