mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.8] [Enterprise Search] Fix broken indices page when an index with alias is closed (#158871) (#158938)
# Backport This will backport the following commits from `main` to `8.8`: - [[Enterprise Search] Fix broken indices page when an index with alias is closed (#158871)](https://github.com/elastic/kibana/pull/158871) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Saarika Bhasi","email":"55930906+saarikabhasi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-06-02T14:57:42Z","message":"[Enterprise Search] Fix broken indices page when an index with alias is closed (#158871)\n\n## Summary\r\n\r\nFix indices page when an index is closed. Added a check to see if the\r\nindex is closed by checking the flag\r\n`index.settings.index.verified_before_close` is set to true\r\n\r\n### Screen Recording\r\n\r\n\r\nf818b92d
-8947-4764-aed9-a8a191cba2e0\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"7c8ddd0ec54442f3556141c9d8897b28c1539e70","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.9.0","v8.8.1"],"number":158871,"url":"https://github.com/elastic/kibana/pull/158871","mergeCommit":{"message":"[Enterprise Search] Fix broken indices page when an index with alias is closed (#158871)\n\n## Summary\r\n\r\nFix indices page when an index is closed. Added a check to see if the\r\nindex is closed by checking the flag\r\n`index.settings.index.verified_before_close` is set to true\r\n\r\n### Screen Recording\r\n\r\n\r\nf818b92d
-8947-4764-aed9-a8a191cba2e0\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"7c8ddd0ec54442f3556141c9d8897b28c1539e70"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158871","number":158871,"mergeCommit":{"message":"[Enterprise Search] Fix broken indices page when an index with alias is closed (#158871)\n\n## Summary\r\n\r\nFix indices page when an index is closed. Added a check to see if the\r\nindex is closed by checking the flag\r\n`index.settings.index.verified_before_close` is set to true\r\n\r\n### Screen Recording\r\n\r\n\r\nf818b92d
-8947-4764-aed9-a8a191cba2e0\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"7c8ddd0ec54442f3556141c9d8897b28c1539e70"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Saarika Bhasi <55930906+saarikabhasi@users.noreply.github.com>
This commit is contained in:
parent
b3a45ca88c
commit
21beb7d50e
2 changed files with 24 additions and 5 deletions
|
@ -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: '*',
|
||||
});
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue