Skip to content

Commit

Permalink
Warn users about conflicting mappings, do not fatal, set type to conf…
Browse files Browse the repository at this point in the history
…lict and indexed to false. Closes #116
  • Loading branch information
Rashid Khan committed Jun 4, 2014
1 parent 47591db commit 122d251
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/kibana/apps/settings/directives/indices/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ define(function (require) {
max: 35
};

$scope.conflictFields = _.filter($scope.indexPattern.fields, {type: 'conflict'});

$scope.refreshFields = function () {
$scope.indexPattern.refreshFields();
};
Expand Down
21 changes: 18 additions & 3 deletions src/kibana/apps/settings/partials/indices/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ <h1>
</h1>
<p>
This page lists every field in the <strong>{{indexPattern.id}}</strong>
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
<a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping.html">
Mapping API
</a>
</p>
<div bo-if="indexPattern.timeFieldName && indexPattern.intervalName" class="alert alert-info">
This index uses a <strong>Time-based index pattern</strong> which repeats <span bo-text="indexPattern.getInterval().display"></span>
</p>
</div>
<div bo-if="conflictFields.length" class="alert alert-warning">
<strong>Mapping conflict!</strong> {{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.
</div>
</div>

<div ng-hide="tablePages() == 1">
Expand Down Expand Up @@ -70,8 +78,15 @@ <h1>
tooltip="This field represents the time that events occured"
class="label label-default">
<i class="fa fa-clock-o"></i>
</span>
</td>
<td>
<span bo-text="field.type"></span>
<i
bo-if="field.type == 'conflict'"
tooltip="The type of this field changes across indices. It is unavailable for many analysis functions"
class="fa fa-warning text-color-warning"></i>
</td>
<td bo-text="field.type"></td>
</tr>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Expand Down
2 changes: 2 additions & 0 deletions src/kibana/directives/field_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ define(function (require) {
return $('<i class="fa fa-clock-o"></i> ');
case 'ip':
return $('<i class="fa fa-laptop"></i> ');
case 'conflict':
return $('<i class="fa fa-warning"></i> ');
default:
return $('<i><strong>?</strong></i> ');
}
Expand Down
15 changes: 15 additions & 0 deletions src/kibana/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
21 changes: 21 additions & 0 deletions src/kibana/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 122d251

Please sign in to comment.