Skip to content

Commit 13b2961

Browse files
authored
Watcher history index has too many indexed fields - (#71479) (#117701) (#117979)
* Exclude result.input.chain from watcher history index mappings * Update docs/changelog/117701.yaml * Fixup text now fields are disabled higher up the chain * Revert priority change
1 parent 9abeeea commit 13b2961

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

docs/changelog/117701.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 117701
2+
summary: Watcher history index has too many indexed fields -
3+
area: Watcher
4+
type: bug
5+
issues:
6+
- 71479

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/support/WatcherIndexTemplateRegistryField.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public final class WatcherIndexTemplateRegistryField {
2222
// version 14: move watch history to data stream
2323
// version 15: remove watches and triggered watches, these are now system indices
2424
// version 16: change watch history ILM policy
25+
// version 17: exclude input chain from indexing
2526
// Note: if you change this, also inform the kibana team around the watcher-ui
26-
public static final int INDEX_TEMPLATE_VERSION = 16;
27+
public static final int INDEX_TEMPLATE_VERSION = 17;
2728
public static final String HISTORY_TEMPLATE_NAME = ".watch-history-" + INDEX_TEMPLATE_VERSION;
2829
public static final String HISTORY_TEMPLATE_NAME_NO_ILM = ".watch-history-no-ilm-" + INDEX_TEMPLATE_VERSION;
2930
public static final String[] TEMPLATE_NAMES = new String[] { HISTORY_TEMPLATE_NAME };

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@
5454
"enabled": false
5555
}
5656
}
57+
},
58+
{
59+
"disabled_result_input_chain_fields": {
60+
"path_match": "result.input.chain",
61+
"mapping": {
62+
"type": "object",
63+
"enabled": false
64+
}
65+
}
5766
}
5867
],
5968
"dynamic": false,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@
5555
"enabled": false
5656
}
5757
}
58+
},
59+
{
60+
"disabled_result_input_chain_fields": {
61+
"path_match": "result.input.chain",
62+
"mapping": {
63+
"type": "object",
64+
"enabled": false
65+
}
66+
}
5867
}
5968
],
6069
"dynamic": false,

x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/integration/HistoryIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void testFailedInputResultWithDotsInFieldNameGetsStored() throws Exceptio
130130
String chainedPath = SINGLE_MAPPING_NAME
131131
+ ".properties.result.properties.input.properties.chain.properties.chained.properties.search"
132132
+ ".properties.request.properties.body.enabled";
133-
assertThat(source.getValue(chainedPath), is(false));
133+
assertThat(source.getValue(chainedPath), nullValue());
134134
} else {
135135
String path = SINGLE_MAPPING_NAME
136136
+ ".properties.result.properties.input.properties.search.properties.request.properties.body.enabled";
@@ -168,11 +168,11 @@ public void testPayloadInputWithDotsInFieldNameWorks() throws Exception {
168168
XContentType.JSON
169169
);
170170

171-
// lets make sure the body fields are disabled
171+
// let's make sure the body fields are disabled or, in the case of chained, the whole object is not indexed
172172
if (useChained) {
173173
String path = SINGLE_MAPPING_NAME
174174
+ ".properties.result.properties.input.properties.chain.properties.chained.properties.payload.enabled";
175-
assertThat(source.getValue(path), is(false));
175+
assertThat(source.getValue(path), nullValue());
176176
} else {
177177
String path = SINGLE_MAPPING_NAME + ".properties.result.properties.input.properties.payload.enabled";
178178
assertThat(source.getValue(path), is(false));

0 commit comments

Comments
 (0)