From b2daf3d2fdb3e9154859b566dc140961ca467ebb Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Wed, 18 Nov 2020 11:03:46 -0700 Subject: [PATCH] Adding sorting to dataset request --- .../server/routes/metrics_explorer/lib/get_dataset_for_field.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts index bd8c5f6beff3e..15e6f7ba86d01 100644 --- a/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts +++ b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts @@ -44,6 +44,7 @@ export const getDatasetForField = async ( }, size: 1, _source: ['event.dataset'], + sort: [{ [timerange.field]: { order: 'desc' } }], }, };