Catch fetchSurroundingDocs missing anchor (#43661)

This commit is contained in:
Matthias Wilhelm 2019-08-22 20:17:57 +02:00 committed by GitHub
parent 90edcf2b10
commit 59e632afe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,6 +72,9 @@ function fetchContextProvider(indexPatterns: IndexPatterns, Private: IPrivate) {
size: number,
filters: Filter[]
) {
if (typeof anchor !== 'object' || anchor === null) {
return [];
}
const indexPattern = await indexPatterns.get(indexPatternId);
const searchSource = await createSearchSource(indexPattern, filters);
const sortDirToApply = type === 'successors' ? sortDir : reverseSortDir(sortDir);