Skip to content

[Fleet] Fix ES error during filtering on agent status#127234

Merged
jen-huang merged 5 commits intoelastic:mainfrom
jen-huang:fix/es-body-hits
Mar 9, 2022
Merged

[Fleet] Fix ES error during filtering on agent status#127234
jen-huang merged 5 commits intoelastic:mainfrom
jen-huang:fix/es-body-hits

Conversation

@jen-huang
Copy link
Copy Markdown
Contributor

Summary

Resolves #127110

This PR fixes an ES error being returned when filtering list of agents by status. This is a regression from #124488 where some default ES client parameters were changed, thereby causing body to no longer be present in the response keys (i.e. res.body.hits -> res.hits).

Most occurrences were caught & fixed during that PR, but a few were missed due to the lines having @ts-expect-error error suppression annotations. This PR removes these annotations by 1) sending rest_total_hits_as_int so that total hits is always returned as a integer, rather than an object and 2) asserting to the compiler that hits.total is indeed a number. If the structure of ES search response changes again in the future, type errors should bubble up.

image

@jen-huang jen-huang added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Fleet Team label for Observability Data Collection Fleet team v8.2.0 labels Mar 9, 2022
@jen-huang jen-huang self-assigned this Mar 9, 2022
@jen-huang jen-huang requested a review from a team as a code owner March 9, 2022 00:51
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jen-huang

Copy link
Copy Markdown
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jen-huang jen-huang merged commit e009115 into elastic:main Mar 9, 2022
@jen-huang jen-huang deleted the fix/es-body-hits branch March 9, 2022 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet]: Error pop-ups on selecting Inactive filter from status dropdown under Agents tab.

4 participants