Skip to content

Commit

Permalink
[Data Explorer] Fix missing field error from taking down the page (#5626
Browse files Browse the repository at this point in the history
) (#5747)

* Handle missing fields error

---------

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 28c1fbb)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 2d781d0 commit dfb9f7a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@ export function createHistogramConfigs(
},
},
];
return data.search.aggs.createAggConfigs(indexPattern, visStateAggs);

// If index pattern is created before the index, this function will fail since the required fields for the histogram agg will be missing.
try {
return data.search.aggs.createAggConfigs(indexPattern, visStateAggs);
} catch (error) {
// Just display the error to the user but continue to render the rest of the page
data.search.showError(error as Error);
return;
}
}

0 comments on commit dfb9f7a

Please sign in to comment.