-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Fix for errors when loading data views which are missing index #147916
[ML] Fix for errors when loading data views which are missing index #147916
Conversation
@@ -18,7 +18,25 @@ let indexPatternsContract: DataViewsContract | null = null; | |||
export async function loadIndexPatterns(indexPatterns: DataViewsContract) { | |||
indexPatternsContract = indexPatterns; | |||
const dataViewsContract = getDataViews(); | |||
indexPatternCache = await dataViewsContract.find('*', 10000); | |||
const idsAndTitles = await dataViewsContract.getIdsWithTitle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now load all of the ids and titles of the data views and attempt to get the fields for them to work out if the index really exists.
Once we have this filtered list of ids for data views which do exist, we can load the actual data views.
It might be better to use an exists check rather than getFieldsForIndexPattern
but that will add additional dependencies to this function.
Pinging @elastic/ml-ui (:ml) |
const idsAndTitles = await dataViewsContract.getIdsWithTitle(); | ||
|
||
const dataViewsThatExist = ( | ||
await Promise.allSettled( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5086eff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest changes and both Anomaly Detection and Data Frame Analytics pages LGTM
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ⚡
Fixes #147886 by manually checking whether the index behind a data view actually exists before fetching it. This fixes the issue with the data view service which displays a toast for every data view which it cannot load the fields for.
This fix has the potential to increase the amount of requests to es by quite a large amount.
For example, if a user has 100 data views, 80 of which have existing indices.
1 request is made to load all data view ids and titles
100 requests are made to fetch the fields for each index. 80 succeed.
80 requests are then made to fetch each data view.
In 8.0 this behaviour has been changed. We no longer request all of the data views up front on page load.