diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts index 1bbf1b8d8ae8..65af9b5a7a3d 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -114,7 +114,10 @@ export interface InfraDatabaseSearchResponse }; aggregations?: Aggregations; hits: { - total: number; + total: { + value: number; + relation: string; + }; hits: Hit[]; }; } diff --git a/x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts index c098704f1caa..88847acb2908 100644 --- a/x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts +++ b/x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts @@ -14,7 +14,6 @@ export const checkValidNode = async ( ): Promise => { const params = { index: indexPattern, - rest_total_hits_as_int: true, terminateAfter: 1, body: { size: 0, @@ -25,5 +24,7 @@ export const checkValidNode = async ( }, }, }; - return (await search(params)).hits.total > 0; + + const result = await search(params); + return result && result.hits && result.hits.total && result.hits.total.value > 0; };