diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts index b7e340fddbd2..9480aee75bb9 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts @@ -31,49 +31,25 @@ describe('getLatestMonitor', () => { ], }, }, - aggs: { - by_id: { - terms: { - field: 'monitor.id', - size: 1000, - }, - aggs: { - latest: { - top_hits: { - size: 1, - sort: { - '@timestamp': { order: 'desc' }, - }, - }, - }, - }, - }, + size: 1, + _source: ['url', 'monitor', 'observer', 'tls', '@timestamp'], + sort: { + '@timestamp': { order: 'desc' }, }, - size: 0, }, }; mockEsSearchResult = { - aggregations: { - by_id: { - buckets: [ - { - latest: { - hits: { - hits: [ - { - _source: { - '@timestamp': 123456, - monitor: { - id: 'testMonitor', - }, - }, - }, - ], - }, + hits: { + hits: [ + { + _source: { + '@timestamp': 123456, + monitor: { + id: 'testMonitor', }, }, - ], - }, + }, + ], }, }; });