diff --git a/x-pack/plugins/index_management/public/application/store/selectors/index.js b/x-pack/plugins/index_management/public/application/store/selectors/index.js index 24b09dd37e377..c80658581dbee 100644 --- a/x-pack/plugins/index_management/public/application/store/selectors/index.js +++ b/x-pack/plugins/index_management/public/application/store/selectors/index.js @@ -90,24 +90,13 @@ export const getFilteredIndices = createSelector( (indices, allIds, tableState, tableLocation) => { let indexArray = allIds.map((indexName) => indices[indexName]); indexArray = filterByToggles(indexArray, tableState.toggleNameToVisibleMap); - const { includeHiddenIndices: includeHiddenParam, dataStreams: dataStreamsParam } = qs.parse( - tableLocation.search - ); + const { includeHiddenIndices: includeHiddenParam } = qs.parse(tableLocation.search); const includeHidden = includeHiddenParam === 'true'; - const dataStreamsFilter = dataStreamsParam ? dataStreamsParam.split(',') : undefined; - const shouldFilterDataStreams = Boolean(dataStreamsFilter && dataStreamsFilter.length); - const filteredIndices = indexArray.filter((index) => { - let include = true; - if (!includeHidden) { - include = !(index.name + '').startsWith('.') && !index.hidden; - } - - if (include && shouldFilterDataStreams) { - return dataStreamsFilter.includes(index.dataStream); - } - - return include; - }); + const filteredIndices = includeHidden + ? indexArray + : indexArray.filter((index) => { + return !(index.name + '').startsWith('.') && !index.hidden; + }); const filter = tableState.filter || EuiSearchBar.Query.MATCH_ALL; return EuiSearchBar.Query.execute(filter, filteredIndices, { defaultFields: defaultFilterFields, diff --git a/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts b/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts index ef32a1ba93ca9..f230ddd18e9eb 100644 --- a/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts +++ b/x-pack/plugins/index_management/public/application/store/selectors/indices_filter.test.ts @@ -20,9 +20,9 @@ describe('getFilteredIndices selector', () => { tableState: { ...defaultTableState }, indices: { byId: { - test: { name: 'index1', hidden: true, dataStream: '123' }, + test: { name: 'index1', hidden: true }, anotherTest: { name: 'index2', hidden: false }, - aTest: { name: 'index3', dataStream: 'abc' }, + aTest: { name: 'index3' }, aFinalTest: { name: '.index4' }, }, allIds: ['test', 'anotherTest', 'aTest', 'aFinalTest'], @@ -32,7 +32,7 @@ describe('getFilteredIndices selector', () => { it('filters out hidden indices', () => { expect(getFilteredIndices(state, { location: { search: '' } })).toEqual([ { name: 'index2', hidden: false }, - { name: 'index3', dataStream: 'abc' }, + { name: 'index3' }, ]); }); @@ -40,29 +40,10 @@ describe('getFilteredIndices selector', () => { expect( getFilteredIndices(state, { location: { search: '?includeHiddenIndices=true' } }) ).toEqual([ - { name: 'index1', hidden: true, dataStream: '123' }, + { name: 'index1', hidden: true }, { name: 'index2', hidden: false }, - { name: 'index3', dataStream: 'abc' }, + { name: 'index3' }, { name: '.index4' }, ]); }); - - it('filters based on data stream', () => { - expect(getFilteredIndices(state, { location: { search: '?dataStreams=abc' } })).toEqual([ - // We don't expect to see a case like this in the wild because data stream backing indicies - // are always hidden, but our logic can handle it - { name: 'index3', dataStream: 'abc' }, - ]); - }); - - it('filters based on data stream and includes hidden indices', () => { - expect( - getFilteredIndices(state, { - location: { search: '?includeHiddenIndices=true&dataStreams=123,abc,does-not-exist' }, - }) - ).toEqual([ - { name: 'index1', hidden: true, dataStream: '123' }, - { name: 'index3', dataStream: 'abc' }, - ]); - }); });