From c3ef7a6c64d30b2873fa583469e1a77435b8ba19 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 4 Jun 2014 16:26:04 -0700 Subject: [PATCH] Warn users about conflicting mappings, do not fatal, set type to conflict and indexed to false. Closes #116 --- .../apps/settings/directives/indices/edit.js | 2 ++ .../apps/settings/partials/indices/edit.html | 21 ++++++++++++++++--- .../_transform_mapping_into_fields.js | 7 ++++--- src/kibana/directives/field_name.js | 2 ++ src/kibana/styles/main.css | 15 +++++++++++++ src/kibana/styles/main.less | 21 +++++++++++++++++++ 6 files changed, 62 insertions(+), 6 deletions(-) diff --git a/src/kibana/apps/settings/directives/indices/edit.js b/src/kibana/apps/settings/directives/indices/edit.js index c2973f05c1c8e5..775f396a7cff9f 100644 --- a/src/kibana/apps/settings/directives/indices/edit.js +++ b/src/kibana/apps/settings/directives/indices/edit.js @@ -27,6 +27,8 @@ define(function (require) { max: 35 }; + $scope.conflictFields = _.filter($scope.indexPattern.fields, {type: 'conflict'}); + $scope.refreshFields = function () { $scope.indexPattern.refreshFields(); }; diff --git a/src/kibana/apps/settings/partials/indices/edit.html b/src/kibana/apps/settings/partials/indices/edit.html index 375e11b40a10a7..3796ca65cacdb4 100644 --- a/src/kibana/apps/settings/partials/indices/edit.html +++ b/src/kibana/apps/settings/partials/indices/edit.html @@ -27,11 +27,19 @@

This page lists every field in the {{indexPattern.id}} - index and the field's associated core type as recorded by Elasticsearch + index and the field's associated core type as recorded by Elasticsearch. + While this list allows you to view the core type of each field, changing + field types must be done using Elasticsearch's + + Mapping API +

This index uses a Time-based index pattern which repeats -

+
+
+ Mapping conflict! {{conflictFields.length > 1 ? conflictFields.length : 'A'}} field{{conflictFields.length > 1 ? 's' : ''}} {{conflictFields.length > 1 ? 'are' : 'is'}} defined as several types (string, integer, etc) across the indices that match this pattern. You may still be able to use these conflict fields in parts of Kibana, but they will be unavailable for functions that require Kibana to know their type. Correcting this issue will require reindexing your data. +
@@ -70,8 +78,15 @@

tooltip="This field represents the time that events occured" class="label label-default"> + + + + + -

diff --git a/src/kibana/components/index_patterns/_transform_mapping_into_fields.js b/src/kibana/components/index_patterns/_transform_mapping_into_fields.js index 5e2ac7b1108f19..a24fe36e4da0dc 100644 --- a/src/kibana/components/index_patterns/_transform_mapping_into_fields.js +++ b/src/kibana/components/index_patterns/_transform_mapping_into_fields.js @@ -32,11 +32,12 @@ define(function (require) { if (fields[name]) { if (fields[name].type !== mapping.type ) { - throw new MappingConflict(name); + // conflict fields are not available for much except showing in the discover table + mapping.type = 'conflict'; + mapping.indexed = false; + } - return; } - fields[name] = _.pick(mapping, 'type', 'indexed', 'analyzed'); }); }); diff --git a/src/kibana/directives/field_name.js b/src/kibana/directives/field_name.js index b63b4e8734e099..94aa56f1e2d585 100644 --- a/src/kibana/directives/field_name.js +++ b/src/kibana/directives/field_name.js @@ -25,6 +25,8 @@ define(function (require) { return $(' '); case 'ip': return $(' '); + case 'conflict': + return $(' '); default: return $('? '); } diff --git a/src/kibana/styles/main.css b/src/kibana/styles/main.css index c33e89817f934c..e2e092793f54f5 100644 --- a/src/kibana/styles/main.css +++ b/src/kibana/styles/main.css @@ -7025,6 +7025,21 @@ body { height: 100%; margin: 0px; } +.text-color-primary { + color: #46525d; +} +.text-color-info { + color: #3498db; +} +.text-color-success { + color: #31c471; +} +.text-color-warning { + color: #f39c12; +} +.text-color-danger { + color: #e74c3c; +} ul.navbar-inline li { display: inline; } diff --git a/src/kibana/styles/main.less b/src/kibana/styles/main.less index f1f2570d2628a6..007399436e2ad8 100644 --- a/src/kibana/styles/main.less +++ b/src/kibana/styles/main.less @@ -29,6 +29,27 @@ body { margin: 0px; } +// Colors available for font awesome icons, these might not look good with normal text +.text-color-primary { + color: @brand-primary; +} + +.text-color-info { + color: @brand-info; +} + +.text-color-success { + color: @brand-success; +} + +.text-color-warning { + color: @brand-warning; +} + +.text-color-danger { + color: @brand-danger; +} + ul.navbar-inline li { display: inline; }