[data.search.aggs] Remove use_field_mapping from top hits agg (#71168)

This commit is contained in:
Luke Elmers 2020-07-14 08:19:14 -06:00 committed by GitHub
parent 50f8db75ce
commit 7b026bb984
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 12 deletions

View file

@ -111,9 +111,7 @@ describe('Top hit metric', () => {
it('requests both source and docvalues_fields for non-text aggregatable fields', () => {
init({ fieldName: 'bytes', readFromDocValues: true });
expect(aggDsl.top_hits._source).toBe('bytes');
expect(aggDsl.top_hits.docvalue_fields).toEqual([
{ field: 'bytes', format: 'use_field_mapping' },
]);
expect(aggDsl.top_hits.docvalue_fields).toEqual([{ field: 'bytes' }]);
});
it('requests both source and docvalues_fields for date aggregatable fields', () => {

View file

@ -88,12 +88,15 @@ export const getTopHitMetricAgg = () => {
};
} else {
if (field.readFromDocValues) {
// always format date fields as date_time to avoid
// displaying unformatted dates like epoch_millis
// or other not-accepted momentjs formats
const format =
field.type === KBN_FIELD_TYPES.DATE ? 'date_time' : 'use_field_mapping';
output.params.docvalue_fields = [{ field: field.name, format }];
output.params.docvalue_fields = [
{
field: field.name,
// always format date fields as date_time to avoid
// displaying unformatted dates like epoch_millis
// or other not-accepted momentjs formats
...(field.type === KBN_FIELD_TYPES.DATE && { format: 'date_time' }),
},
];
}
output.params._source = field.name === '_source' ? true : field.name;
}

View file

@ -246,9 +246,7 @@ export default function ({ getService, getPageObjects }) {
await inspector.close();
});
// Preventing ES Promotion for master (8.0)
// https://github.com/elastic/kibana/issues/64734
it.skip('does not scale top hit agg', async () => {
it('does not scale top hit agg', async () => {
const expectedTableData = [
['2015-09-20 00:00', '6', '9.035KB'],
['2015-09-20 01:00', '9', '5.854KB'],