Skip to content

Commit

Permalink
[Discover] Refresh fields when entering Discover (#160195)
Browse files Browse the repository at this point in the history
- Closes #156556
- Probably also addresses
#157239

## Summary

This PR allows to refresh fields list when revisiting Discover page.

## For testing

1. Open discover
2. In a separate tab open Dev Tools and create documents which include
new field names
3. Press "Refresh" in the unified search bar on Discover and notice that
new fields appear under Unmapped section
4. Navigate to another Kibana app (for example Home page)
5. Navigate back to Discover and notice that new fields are now under
Available section and have a proper icon.

(cherry picked from commit 4819efa)
  • Loading branch information
jughosta committed Jul 4, 2023
1 parent ddd5084 commit ffbe957
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function loadDataView({
let fetchedDataView: DataView | null = null;
// try to fetch adhoc data view first
try {
fetchedDataView = fetchId ? await dataViews.get(fetchId, false) : null;
fetchedDataView = fetchId ? await dataViews.get(fetchId, false, true) : null;
if (fetchedDataView && !fetchedDataView.isPersisted()) {
return {
list: dataViewList || [],
Expand All @@ -88,7 +88,10 @@ export async function loadDataView({
let defaultDataView: DataView | null = null;
if (!fetchedDataView) {
try {
defaultDataView = await dataViews.getDefaultDataView({ displayErrors: false });
defaultDataView = await dataViews.getDefaultDataView({
displayErrors: false,
refreshFields: true,
});
} catch (e) {
//
}
Expand Down

0 comments on commit ffbe957

Please sign in to comment.