Skip to content

Commit 956d511

Browse files
committed
Fix logic when calling get index endpoint with empty array
Also remove unused translations
1 parent 9ca7880 commit 956d511

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

x-pack/plugins/index_management/server/lib/fetch_indices.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ async function fetchIndicesCall(
3838
callAsCurrentUser: CallAsCurrentUser,
3939
indexNames?: string[]
4040
): Promise<Index[]> {
41+
let indexNamesCSV: string;
42+
if (indexNames && indexNames.length) {
43+
indexNamesCSV = indexNames.join(',');
44+
} else {
45+
indexNamesCSV = '*';
46+
}
47+
48+
// This call retrieves alias and settings (incl. hidden status) information about indices
4149
const indices: GetIndicesResponse = await callAsCurrentUser('transport.request', {
4250
method: 'GET',
43-
path: `/${indexNames ? indexNames : '*'}`,
51+
path: `/${indexNamesCSV}`,
4452
query: {
4553
expand_wildcards: 'hidden,all',
4654
},
@@ -57,18 +65,17 @@ async function fetchIndicesCall(
5765
format: 'json',
5866
h: 'health,status,index,uuid,pri,rep,docs.count,sth,store.size',
5967
expand_wildcards: 'hidden,all',
68+
index: indexNamesCSV,
6069
};
6170

62-
if (indexNames) {
63-
catQuery.index = indexNames.join(',');
64-
}
65-
71+
// This call retrieves health and other high-level information about indices.
6672
const catHits: Hit[] = await callAsCurrentUser('transport.request', {
6773
method: 'GET',
6874
path: '/_cat/indices',
6975
query: catQuery,
7076
});
7177

78+
// The two responses should be equal in the number of indices returned
7279
return catHits.map(hit => {
7380
const index = indices[hit.index];
7481
const aliases = Object.keys(index.aliases);
@@ -94,6 +101,6 @@ export const fetchIndices = async (
94101
indexDataEnricher: IndexDataEnricher,
95102
indexNames?: string[]
96103
) => {
97-
const response = await fetchIndicesCall(callAsCurrentUser, indexNames);
98-
return await indexDataEnricher.enrichIndices(response, callAsCurrentUser);
104+
const indices = await fetchIndicesCall(callAsCurrentUser, indexNames);
105+
return await indexDataEnricher.enrichIndices(indices, callAsCurrentUser);
99106
};

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6736,7 +6736,6 @@
67366736
"xpack.idxMgmt.indexTable.serverErrorTitle": "インデックスの読み込み中にエラーが発生",
67376737
"xpack.idxMgmt.indexTable.systemIndicesSearchIndicesAriaLabel": "インデックスの検索",
67386738
"xpack.idxMgmt.indexTable.systemIndicesSearchInputPlaceholder": "検索",
6739-
"xpack.idxMgmt.indexTable.systemIndicesSwitchLabel": "システムインデックスを含める",
67406739
"xpack.idxMgmt.indexTemplatesList.emptyPrompt.noIndexTemplatesTitle": "まだテンプレートがありません",
67416740
"xpack.idxMgmt.indexTemplatesList.loadingIndexTemplatesDescription": "テンプレートを読み込み中…",
67426741
"xpack.idxMgmt.indexTemplatesList.loadingIndexTemplatesErrorMessage": "テンプレートの読み込み中にエラーが発生",

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6741,7 +6741,6 @@
67416741
"xpack.idxMgmt.indexTable.serverErrorTitle": "加载索引时出错",
67426742
"xpack.idxMgmt.indexTable.systemIndicesSearchIndicesAriaLabel": "搜索索引",
67436743
"xpack.idxMgmt.indexTable.systemIndicesSearchInputPlaceholder": "搜索",
6744-
"xpack.idxMgmt.indexTable.systemIndicesSwitchLabel": "包括系统索引",
67456744
"xpack.idxMgmt.indexTemplatesList.emptyPrompt.noIndexTemplatesTitle": "您尚未有任何模板",
67466745
"xpack.idxMgmt.indexTemplatesList.loadingIndexTemplatesDescription": "正在加载模板……",
67476746
"xpack.idxMgmt.indexTemplatesList.loadingIndexTemplatesErrorMessage": "加载模板时出错",

x-pack/test/api_integration/apis/management/index_management/indices.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export default function({ getService }) {
184184
const { body } = await list().expect(200);
185185
const expectedKeys = [
186186
'health',
187+
'hidden',
187188
'status',
188189
'name',
189190
'uuid',
@@ -214,6 +215,7 @@ export default function({ getService }) {
214215
const { body } = await reload().expect(200);
215216
const expectedKeys = [
216217
'health',
218+
'hidden',
217219
'status',
218220
'name',
219221
'uuid',

0 commit comments

Comments
 (0)