From ec22d2cbb22261e2011bd59c7e2a59b526dbdc42 Mon Sep 17 00:00:00 2001 From: Dan Panzarella Date: Wed, 11 Nov 2020 13:47:03 -0500 Subject: [PATCH] [7.x] [Security] Report accurate endpoint count (#83092) (#83168) --- .../server/endpoint/routes/metadata/query_builders.test.ts | 4 ++++ .../endpoint/routes/metadata/support/query_strategies.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts index ac1de377124f0..88b141120a904 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts @@ -37,6 +37,7 @@ describe('query builder', () => { }, }, ], + track_total_hits: true, }, from: 0, size: 10, @@ -84,6 +85,7 @@ describe('query builder', () => { }, }, ], + track_total_hits: true, }, from: 0, size: 10, @@ -142,6 +144,7 @@ describe('query builder', () => { }, }, ], + track_total_hits: true, }, from: 0, size: 10, @@ -213,6 +216,7 @@ describe('query builder', () => { }, }, ], + track_total_hits: true, }, from: 0, size: 10, diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/query_strategies.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/query_strategies.ts index f1614cc19e8c8..5c25ff0b99faa 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/query_strategies.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/query_strategies.ts @@ -86,6 +86,9 @@ export function metadataQueryStrategyV2(): MetadataQueryStrategy { }, }, ], + extraBodyProperties: { + track_total_hits: true, + }, queryResponseToHostListResult: ( searchResponse: SearchResponse ): HostListQueryResult => {