From 7c7dc5fdda6833dbf92b709cd89107354ed2d5a4 Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Mon, 21 Dec 2020 14:14:19 -0500 Subject: [PATCH] Fix more sorts by adding unmapped_type (#85837) (#86666) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../server/kibana_monitoring/collectors/lib/fetch_es_usage.ts | 1 + .../kibana_monitoring/collectors/lib/fetch_license_type.ts | 1 + .../monitoring/server/lib/alerts/fetch_legacy_alerts.test.ts | 2 +- .../plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.ts | 1 + .../server/lib/alerts/fetch_missing_monitoring_data.ts | 1 + x-pack/plugins/monitoring/server/lib/beats/get_beats.ts | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_es_usage.ts b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_es_usage.ts index de0a1b8f99d968..9f054f4f95adfe 100644 --- a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_es_usage.ts +++ b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_es_usage.ts @@ -58,6 +58,7 @@ export async function fetchESUsage( { timestamp: { order: 'desc', + unmapped_type: 'long', }, }, ], diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_license_type.ts b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_license_type.ts index f7b8b72637b1ff..4e132eac1fba47 100644 --- a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_license_type.ts +++ b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/lib/fetch_license_type.ts @@ -27,6 +27,7 @@ export async function fetchLicenseType( { timestamp: { order: 'desc', + unmapped_type: 'long', }, }, ], diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.test.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.test.ts index 50550170518164..a5331beeae067a 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.test.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.test.ts @@ -70,7 +70,7 @@ describe('fetchLegacyAlerts', () => { ], body: { size, - sort: [{ timestamp: { order: 'desc' } }], + sort: [{ timestamp: { order: 'desc', unmapped_type: 'long' } }], query: { bool: { minimum_should_match: 1, diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.ts index 0ea37b4ac4daa5..c6416a992276ee 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_legacy_alerts.ts @@ -28,6 +28,7 @@ export async function fetchLegacyAlerts( { timestamp: { order: 'desc', + unmapped_type: 'long', }, }, ], diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts index 30706a0b3c922c..1bfe3a367fc951 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts @@ -97,6 +97,7 @@ export async function fetchMissingMonitoringData( { timestamp: { order: 'desc', + unmapped_type: 'long', }, }, ], diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts b/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts index beda4334b49374..aa5ef81a8de339 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts +++ b/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts @@ -151,7 +151,7 @@ export async function getBeats(req: LegacyRequest, beatsIndexPattern: string, cl inner_hits: { name: 'earliest', size: 1, - sort: [{ 'beats_stats.timestamp': 'asc' }], + sort: [{ 'beats_stats.timestamp': { order: 'asc', unmapped_type: 'long' } }], }, }, sort: [