mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge pull request #4105 from spalger/implement/scoreAsMetaField
[indexPattern] added _score as a default meta field
This commit is contained in:
commit
523c199aed
7 changed files with 23 additions and 13 deletions
|
@ -39,7 +39,7 @@ define(function () {
|
|||
description: 'The index to access if no index is set',
|
||||
},
|
||||
'metaFields': {
|
||||
value: ['_source', '_id', '_type', '_index'],
|
||||
value: ['_source', '_id', '_type', '_index', '_score'],
|
||||
description: 'Fields that exist outside of _source to merge into our document when displaying it',
|
||||
},
|
||||
'discover:sampleSize': {
|
||||
|
|
|
@ -23,4 +23,4 @@ doc-table {
|
|||
z-index: 20;
|
||||
opacity: @loading-opacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ define(function (require) {
|
|||
* @return {String} - the most specific type that we care for
|
||||
*/
|
||||
function castMappingType(name) {
|
||||
var match = castMappingType.types.byName[name];
|
||||
if (!name) return 'unknown';
|
||||
|
||||
if (match) return match.type;
|
||||
return 'string';
|
||||
var match = castMappingType.types.byName[name];
|
||||
return match ? match.type : 'string';
|
||||
}
|
||||
|
||||
return castMappingType;
|
||||
|
|
|
@ -38,8 +38,7 @@ define(function (require) {
|
|||
|
||||
var indexed = !!spec.indexed;
|
||||
var scripted = !!spec.scripted;
|
||||
|
||||
var sortable = (indexed || scripted) && type.sortable;
|
||||
var sortable = spec.name === '_score' || ((indexed || scripted) && type.sortable);
|
||||
var bucketable = indexed || scripted;
|
||||
var filterable = spec.name === '_id' || scripted || (indexed && type.filterable);
|
||||
|
||||
|
|
|
@ -18,14 +18,18 @@ define(function (require) {
|
|||
|
||||
// Override the mapping, even if elasticsearch says otherwise
|
||||
var mappingOverrides = {
|
||||
_timestamp: {
|
||||
indexed: true,
|
||||
type: 'date'
|
||||
},
|
||||
_source: { type: '_source' },
|
||||
_index: { type: 'string' },
|
||||
_type: { type: 'string' },
|
||||
_id: { type: 'string' }
|
||||
_id: { type: 'string' },
|
||||
_timestamp: {
|
||||
type: 'date',
|
||||
indexed: true
|
||||
},
|
||||
_score: {
|
||||
type: 'number',
|
||||
indexed: false
|
||||
}
|
||||
};
|
||||
|
||||
if (!mapping.index || mapping.index === 'no') {
|
||||
|
|
|
@ -36,6 +36,14 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
config.get('metaFields').forEach(function (meta) {
|
||||
if (fields[meta]) return;
|
||||
|
||||
var field = { mapping: {} };
|
||||
field.mapping[meta] = {};
|
||||
fields[meta] = mapField(field, meta);
|
||||
});
|
||||
|
||||
return _.map(fields, function (mapping, name) {
|
||||
mapping.name = name;
|
||||
return mapping;
|
||||
|
|
|
@ -331,7 +331,6 @@ define(function (require) {
|
|||
}
|
||||
|
||||
$scope.updateTime();
|
||||
|
||||
segmented.setDirection(sortBy === 'time' ? (sort[1] || 'desc') : 'desc');
|
||||
segmented.setSize(sortBy === 'time' ? $scope.opts.sampleSize : false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue