diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_indices.test.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_indices.test.ts index 7e731ce71d3571..03198dc6f01d15 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_indices.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_indices.test.ts @@ -303,7 +303,11 @@ describe('fetch indices lib functions', () => { expect(mockClient.asCurrentUser.indices.get).toHaveBeenCalledWith({ expand_wildcards: ['open'], features: ['aliases', 'settings'], - filter_path: ['*.aliases', '*.settings.index.hidden'], + filter_path: [ + '*.aliases', + '*.settings.index.hidden', + '*.settings.index.verified_before_close', + ], index: '*search*', }); @@ -363,7 +367,11 @@ describe('fetch indices lib functions', () => { expect(mockClient.asCurrentUser.indices.get).toHaveBeenCalledWith({ expand_wildcards: ['hidden', 'all'], features: ['aliases', 'settings'], - filter_path: ['*.aliases', '*.settings.index.hidden'], + filter_path: [ + '*.aliases', + '*.settings.index.hidden', + '*.settings.index.verified_before_close', + ], index: '*', }); diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/utils/get_index_data.ts b/x-pack/plugins/enterprise_search/server/lib/indices/utils/get_index_data.ts index 1c8bb88c3e4bf6..68ed32aa6d3f36 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/utils/get_index_data.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/utils/get_index_data.ts @@ -92,6 +92,12 @@ export const getIndexDataMapper = (totalIndexData: TotalIndexData) => { function isHidden(index: IndicesIndexState): boolean { return index.settings?.index?.hidden === true || index.settings?.index?.hidden === 'true'; } +function isClosed(index: IndicesIndexState): boolean { + return ( + index.settings?.index?.verified_before_close === true || + index.settings?.index?.verified_before_close === 'true' + ); +} export const getIndexData = async ( client: IScopedClusterClient, @@ -107,14 +113,19 @@ export const getIndexData = async ( features: ['aliases', 'settings'], // only get specified index properties from ES to keep the response under 536MB // node.js string length limit: https://github.com/nodejs/node/issues/33960 - filter_path: ['*.aliases', '*.settings.index.hidden'], + filter_path: ['*.aliases', '*.settings.index.hidden', '*.settings.index.verified_before_close'], index: onlyShowSearchOptimizedIndices ? 'search-*' : indexPattern, }); const allIndexNames = returnHiddenIndices - ? Object.keys(allIndexMatches) + ? Object.keys(allIndexMatches).filter( + (indexName) => allIndexMatches[indexName] && !isClosed(allIndexMatches[indexName]) + ) : Object.keys(allIndexMatches).filter( - (indexName) => allIndexMatches[indexName] && !isHidden(allIndexMatches[indexName]) + (indexName) => + allIndexMatches[indexName] && + !isHidden(allIndexMatches[indexName]) && + !isClosed(allIndexMatches[indexName]) ); const indexNames = onlyShowSearchOptimizedIndices && searchQuery