Skip to content

Commit

Permalink
[Infra] Fix hosts total count query (#212749)
Browse files Browse the repository at this point in the history
Fixes [#212745](#212745)

## Summary

Fix for the hosts total count query, which was not correctly filtering
hosts from system integration and APM

<img width="584" alt="image"
src="https://github.com/user-attachments/assets/05c3b244-3a0f-425a-82db-3498c1a6dbb7"
/>


### How to test
- Connect Kibana to an edge cluster
- Navigate to Infrastructure > Hosts
- The total number of items on the table should be equal to the number
in the hosts count KPI

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
crespocarlos and elasticmachine authored Mar 4, 2025
1 parent dfe542b commit 8e5b858
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ export async function getHostsCount({
}) {
assertQueryStructure(query);

const apmDocumentSources = await apmDataAccessServices?.getDocumentSources({
start: from,
end: to,
});

const documentsFilter = await getDocumentsFilter({
apmDataAccessServices,
apmDocumentSources,
from,
to,
});
Expand All @@ -37,8 +43,15 @@ export async function getHostsCount({
track_total_hits: false,
query: {
bool: {
filter: [query, ...rangeQuery(from, to)],
should: [...documentsFilter],
filter: [
query,
...rangeQuery(from, to),
{
bool: {
should: [...documentsFilter],
},
},
],
},
},
aggs: {
Expand Down

0 comments on commit 8e5b858

Please sign in to comment.