Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data views] Allow data views created on hidden and system indices - second attempt #168882

Merged
merged 52 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d4d4e20
allow hidden seems to be working, still needs tests
mattkime Oct 6, 2023
4e62891
fix type
mattkime Oct 6, 2023
1abb41d
fix jest tests
mattkime Oct 7, 2023
542c4e4
add functional test
mattkime Oct 8, 2023
4ed4a29
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 9, 2023
5fefa61
fix functional test
mattkime Oct 9, 2023
d0533a1
fix functional test
mattkime Oct 9, 2023
3439c5d
fix functional test
mattkime Oct 10, 2023
8ec5ad0
add comment
mattkime Oct 10, 2023
d544631
Delete test/functional/fixtures/es_archiver/logstash_functional/data.…
mattkime Oct 10, 2023
332a235
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 10, 2023
9369027
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 12, 2023
f03ebed
fix limits file
mattkime Oct 12, 2023
2598670
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 13, 2023
7aba54b
fix allowHidden
mattkime Oct 13, 2023
136e47d
Merge branch 'data_views_really_allow_hidden' of github.com:mattkime/…
mattkime Oct 13, 2023
c60e5e0
update snapshöt
mattkime Oct 14, 2023
f1ac7e2
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 14, 2023
7e29ad5
works with wildcards
mattkime Oct 14, 2023
d284c46
fix jest test
mattkime Oct 14, 2023
46028a6
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 16, 2023
23e6f31
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 16, 2023
acf88be
Merge branch 'data_views_really_allow_hidden' of github.com:mattkime/…
mattkime Oct 16, 2023
907524d
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 17, 2023
8ceffd2
update snapshot
mattkime Oct 17, 2023
6a60356
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 17, 2023
29a238d
fixes
mattkime Oct 20, 2023
4f65a52
Merge branch 'data_views_really_allow_hidden' of github.com:mattkime/…
mattkime Oct 20, 2023
b14cc9a
fix merge mistakes
mattkime Oct 20, 2023
e6d98ee
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 20, 2023
a00264c
fix test
mattkime Oct 20, 2023
1b6169d
add allowHidden to toSpec
mattkime Oct 20, 2023
a78b33f
fix public api, update snapshots
mattkime Oct 20, 2023
c8a1fb2
add timestamp
mattkime Oct 22, 2023
3217eb2
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 22, 2023
184a6a5
Merge branch 'main' into data_views_really_allow_hidden
mattkime Oct 30, 2023
c28374c
Add support for searching hidden indices
lukasolson Nov 7, 2023
16e0f07
Use data view stub instead of discover utils
lukasolson Nov 7, 2023
f2d605d
Merge pull request #18 from lukasolson/mattkime_data_views_really_all…
mattkime Nov 7, 2023
d259c77
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 7, 2023
e4e546a
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 8, 2023
66434c0
fix searches with allow all
mattkime Nov 8, 2023
99a8274
Merge branch 'data_views_really_allow_hidden' of github.com:mattkime/…
mattkime Nov 8, 2023
1614b7d
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 9, 2023
ac7e4ed
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 10, 2023
28cdde2
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 11, 2023
47b0030
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 11, 2023
f6f115b
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 12, 2023
8b75fa4
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 14, 2023
bfcf089
Merge branch 'main' into data_views_really_allow_hidden
kibanamachine Nov 14, 2023
32bdf63
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 14, 2023
bc471b1
Merge branch 'main' into data_views_really_allow_hidden
mattkime Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const IndexPatternEditorFlyoutContentComponent = ({
title: editData.getIndexPattern(),
id: editData.id,
name: editData.name,
allowHidden: editData.getAllowHidden(),
...(editData.timeFieldName
? {
timestampField: { label: editData.timeFieldName, value: editData.timeFieldName },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ const DataViewFlyoutContentContainer = ({
try {
let saveResponse;
if (editData) {
const { name = '', timeFieldName, title = '' } = dataViewSpec;
const { name = '', timeFieldName, title = '', allowHidden } = dataViewSpec;
editData.setIndexPattern(title);
editData.name = name;
editData.timeFieldName = timeFieldName;
editData.setAllowHidden(allowHidden || false);
saveResponse = editData.isPersisted()
? await dataViews.updateSavedObject(editData)
: editData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const dataViewAttributesSchema = schema.object(
allowNoIndex: schema.maybe(schema.boolean()),
runtimeFieldMap: schema.maybe(schema.any()),
name: schema.maybe(schema.string()),
allowHidden: schema.maybe(schema.boolean()),
},
{ unknowns: 'forbid' }
);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/data_views/common/data_views/data_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export class DataView implements DataViewBase {

getAllowHidden = () => this.allowHidden;

setAllowHidden = (allowHidden: boolean) => (this.allowHidden = allowHidden);

/**
* Set index pattern
* @param string index pattern string
Expand Down Expand Up @@ -466,6 +468,7 @@ export class DataView implements DataViewBase {
allowNoIndex: this.allowNoIndex ? this.allowNoIndex : undefined,
runtimeFieldMap: runtimeFieldMap ? JSON.stringify(runtimeFieldMap) : undefined,
name: this.name,
allowHidden: this.allowHidden,
};
}

Expand Down
1 change: 1 addition & 0 deletions src/plugins/data_views/common/data_views/data_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ export class DataViewsService {
type,
rollupIndex: typeMeta?.params?.rollup_index,
allowNoIndex: spec.allowNoIndex,
allowHidden: spec.allowHidden,
},
spec.fieldAttrs,
displayErrors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class DataViewsApiClient implements IDataViewsApiClient {
indexFilter,
includeUnmapped,
fields,
allowHidden,
} = options;
return this._request<FieldsForWildcardResponse>(
FIELDS_FOR_WILDCARD_PATH,
Expand All @@ -71,6 +72,7 @@ export class DataViewsApiClient implements IDataViewsApiClient {
allow_no_index: allowNoIndex,
include_unmapped: includeUnmapped,
fields,
allow_hidden: allowHidden,
},
indexFilter ? JSON.stringify({ index_filter: indexFilter }) : undefined
).then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class DataViewsStorage extends SOContentStorage<DataViewCrudTypes> {
'runtimeFieldMap',
'allowNoIndex',
'name',
'allowHidden',
],
mSearchAdditionalSearchFields: ['name'],
logger,
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data_views/server/fetcher/lib/es_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface FieldCapsApiParams {
fieldCapsOptions?: { allow_no_indices: boolean; include_unmapped?: boolean };
indexFilter?: QueryDslQueryContainer;
fields?: string[];
expandWildcard?: ExpandWildcard;
expandWildcards?: ExpandWildcard;
}

/**
Expand All @@ -71,6 +71,7 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
include_unmapped: false,
},
fields = ['*'],
expandWildcards,
} = params;
try {
return await callCluster.fieldCaps(
Expand All @@ -79,6 +80,7 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
fields,
ignore_unavailable: true,
index_filter: indexFilter,
expand_wildcards: expandWildcards,
...fieldCapsOptions,
},
{ meta: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('index_patterns/field_capabilities/field_capabilities', () => {
const fillUndefinedParams = (args) => ({
callCluster: undefined,
indices: undefined,
expandWildcard: undefined,
expandWildcards: undefined,
fieldCapsOptions: undefined,
indexFilter: undefined,
fields: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function getFieldCapabilities(params: FieldCapabilitiesParams) {
fieldCapsOptions,
indexFilter,
fields,
expandWildcard: expandWildcards,
expandWildcards,
});
const fieldCapsArr = readFieldCapsResponse(esFieldCaps.body);
const fieldsFromFieldCapsByName = keyBy(fieldCapsArr, 'name');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('hidden index support', () => {
it('can create data view against hidden index', async () => {
const pattern = 'logstash-2015.09.21';
const pattern = 'logstash-2015.09.2*';

await es.transport.request({
path: '/logstash-2015.09.21/_settings',
path: '/logstash-2015.09.2*/_settings',
method: 'PUT',
body: {
index: {
Expand All @@ -276,6 +276,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
const patternName = await PageObjects.settings.getIndexPageHeading();
expect(patternName).to.be(pattern);

// verify that allow hidden persists through reload
await browser.refresh();

await testSubjects.click('editIndexPatternButton');
await testSubjects.click('toggleAdvancedSetting');
const allowHiddenField = await testSubjects.find('allowHiddenField');
const button = await allowHiddenField.findByTagName('button');
expect(await button.getAttribute('aria-checked')).to.be('true');
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ export class SettingsPageObject extends FtrService {

async allowHiddenClick() {
await this.testSubjects.click('toggleAdvancedSetting');
await this.testSubjects.click('allowHiddenField');
const allowHiddenField = await this.testSubjects.find('allowHiddenField');
(await allowHiddenField.findByTagName('button')).click();
}

async createIndexPattern(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ describe('LogViewsClient class', () => {
"type": "keyword",
},
},
"setAllowHidden": [Function],
"setFieldFormat": [Function],
"setIndexPattern": [Function],
"shortDotsEnable": false,
Expand Down