Skip to content

Commit

Permalink
do not rely on init_default_field_props to set the doc_values property
Browse files Browse the repository at this point in the history
  • Loading branch information
scampi committed Nov 21, 2016
1 parent b465438 commit 19e2104
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 196 deletions.

This file was deleted.

50 changes: 0 additions & 50 deletions src/core_plugins/kibana/server/lib/init_default_field_props.js

This file was deleted.

38 changes: 0 additions & 38 deletions src/core_plugins/kibana/server/lib/mapping_overrides.js

This file was deleted.

5 changes: 4 additions & 1 deletion src/fixtures/logstash_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function stubbedLogstashFields() {
// | | |aggregatable
// | | | |searchable
// name type | | | | |metadata
['bytes', 'number', true, true, true, true, { count: 10 } ],
['bytes', 'number', true, true, true, true, { count: 10, doc_values: true } ],
['ssl', 'boolean', true, true, true, true, { count: 20 } ],
['@timestamp', 'date', true, true, true, true, { count: 30 } ],
['time', 'date', true, true, true, true, { count: 30 } ],
Expand All @@ -20,6 +20,7 @@ function stubbedLogstashFields() {
['geo.coordinates', 'geo_point', true, true, true, true ],
['extension', 'string', true, true, true, true ],
['machine.os', 'string', true, true, true, true ],
['machine.os.raw', 'string', true, false, true, true, { doc_values: true } ],
['geo.src', 'string', true, true, true, true ],
['_id', 'string', false, false, true, true ],
['_type', 'string', false, false, true, true ],
Expand All @@ -41,6 +42,7 @@ function stubbedLogstashFields() {
] = row;

const {
doc_values = false,
count = 0,
script,
lang = script ? 'expression' : undefined,
Expand All @@ -50,6 +52,7 @@ function stubbedLogstashFields() {
return {
name,
type,
doc_values,
indexed,
analyzed,
aggregatable,
Expand Down
3 changes: 1 addition & 2 deletions src/test_utils/stub_index_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import getComputedFields from 'ui/index_patterns/_get_computed_fields';
import RegistryFieldFormatsProvider from 'ui/registry/field_formats';
import IndexPatternsFlattenHitProvider from 'ui/index_patterns/_flatten_hit';
import IndexPatternsFieldProvider from 'ui/index_patterns/_field';
import initDefaultFieldProps from '../core_plugins/kibana/server/lib/init_default_field_props';

export default function (Private) {
let fieldFormats = Private(RegistryFieldFormatsProvider);
Expand Down Expand Up @@ -44,7 +43,7 @@ export default function (Private) {
this.fields = new IndexedArray({
index: ['name'],
group: ['type'],
initialSet: initDefaultFieldProps(fields).map(function (field) {
initialSet: fields.map(function (field) {
return new Field(this, field);
}, this)
});
Expand Down
11 changes: 6 additions & 5 deletions src/ui/public/agg_types/__tests__/metrics/top_hit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,18 @@ describe('Top hit metric', function () {
hits: [
{
_source: {
'machine.os': 'linux'
},
fields: {
'machine.os': [ 'linux' ]
'machine.os.raw': [ 'linux' ]
}
}
]
}
}
};

init({ field: 'machine.os' });
init({ field: 'machine.os.raw' });
expect(topHitMetric.getValue(aggConfig, bucket)).to.be('linux');
});

Expand All @@ -194,18 +195,18 @@ describe('Top hit metric', function () {
hits: [
{
_source: {
nope: 'aaa'
bytes: 12345
},
fields: {
nope: [ 'aaa' ]
bytes: 12345
}
}
]
}
}
};

init({ field: 'machine.os' });
init({ field: 'machine.os.raw' });
expect(topHitMetric.getValue(aggConfig, bucket)).to.be(null);
});
});
Expand Down

0 comments on commit 19e2104

Please sign in to comment.