mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] Automatically migrate saved objects created by data recognizer (#29736)
* [ML] Automatically migrate saved objects created by data recognizer * [ML] Remove TODO from saved object import step
This commit is contained in:
parent
95cbc4ffd7
commit
0c86822e40
10 changed files with 5 additions and 10 deletions
|
@ -385,7 +385,11 @@ export class DataRecognizer {
|
|||
let results = { saved_objects: [] };
|
||||
const filteredSavedObjects = objectExistResults.filter(o => o.exists === false).map(o => o.savedObject);
|
||||
if (filteredSavedObjects.length) {
|
||||
results = await this.savedObjectsClient.bulkCreate(filteredSavedObjects);
|
||||
results = await this.savedObjectsClient.bulkCreate(
|
||||
// Add an empty migrationVersion attribute to each saved object to ensure
|
||||
// it is automatically migrated to the 7.0+ format with a references attribute.
|
||||
filteredSavedObjects.map(doc => ({ ...doc, migrationVersion: doc.migrationVersion || { } }))
|
||||
);
|
||||
}
|
||||
return results.saved_objects;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Remote-IP-Timechart\",\"col\":1,\"row\":1},{\"size_x\":6,\"size_y\":3,\"panelIndex\":2,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Response-Code-Timechart\",\"col\":7,\"row\":1},{\"size_x\":6,\"size_y\":3,\"panelIndex\":3,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Top-Remote-IPs-Table\",\"col\":1,\"row\":4},{\"size_x\":6,\"size_y\":3,\"panelIndex\":4,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Map\",\"col\":7,\"row\":4},{\"size_x\":12,\"size_y\":9,\"panelIndex\":5,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Top-URLs-Table\",\"col\":1,\"row\":7}]",
|
||||
"optionsJSON": "{}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}],\"highlightAll\":true,\"version\":true}"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"panelsJSON": "[{\"col\":1,\"id\":\"ML-Apache2-Access-Unique-Count-URL-Timechart\",\"panelIndex\":1,\"row\":1,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"ML-Apache2-Access-Response-Code-Timechart\",\"panelIndex\":2,\"row\":1,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"ML-Apache2-Access-Top-Remote-IPs-Table\",\"panelIndex\":3,\"row\":4,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"ML-Apache2-Access-Map\",\"panelIndex\":4,\"row\":4,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"size_x\":12,\"size_y\":8,\"panelIndex\":5,\"type\":\"visualization\",\"id\":\"ML-Apache2-Access-Top-URLs-Table\",\"col\":1,\"row\":7}]",
|
||||
"optionsJSON": "{}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}],\"highlightAll\":true,\"version\":true}"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"description": "Filebeat Apache2 Access Data",
|
||||
"title": "ML Apache2 Access Data",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{\"index\":\"INDEX_PATTERN_ID\",\"query\":{\"query_string\":{\"query\":\"_exists_:apache2.access\",\"analyze_wildcard\":true}},\"filter\":[],\"highlight\":{\"pre_tags\":[\"@kibana-highlighted-field@\"],\"post_tags\":[\"@/kibana-highlighted-field@\"],\"fields\":{\"*\":{}},\"require_field_match\":false,\"fragment_size\":2147483647}}"
|
||||
},
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Map",
|
||||
"uiStateJSON": "{\n \"mapCenter\": [\n 12.039320557540572,\n -0.17578125\n ]\n}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{\"filter\":[]}"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Remote IP Timechart",
|
||||
"uiStateJSON": "{\"vis\":{\"legendOpen\":false}}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Response Code Timechart",
|
||||
"uiStateJSON": "{\n \"vis\": {\n \"colors\": {\n \"200\": \"#7EB26D\",\n \"404\": \"#614D93\"\n }\n }\n}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{\"filter\":[]}"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Top Remote IPs Table",
|
||||
"uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Top URLs Table",
|
||||
"uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"title": "ML Apache2 Access Unique Count URL Timechart",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"migrationVersion": {},
|
||||
"savedSearchId": "ML-Filebeat-Apache2-Access",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue