diff --git a/src/plugins/data_views/public/data_views/data_views_api_client.ts b/src/plugins/data_views/public/data_views/data_views_api_client.ts index c65db9e5c736f..762d98059dcae 100644 --- a/src/plugins/data_views/public/data_views/data_views_api_client.ts +++ b/src/plugins/data_views/public/data_views/data_views_api_client.ts @@ -93,6 +93,7 @@ export class DataViewsApiClient implements IDataViewsApiClient { } = options; const path = indexFilter ? FIELDS_FOR_WILDCARD_PATH : FIELDS_PATH; const versionQueryParam = indexFilter ? {} : { apiVersion: version }; + const ftrCacheBuster = localStorage.getItem('dataViews:ftrCacheBuster'); return this._request( path, @@ -106,6 +107,7 @@ export class DataViewsApiClient implements IDataViewsApiClient { fields, allow_hidden: allowHidden, ...versionQueryParam, + ...(ftrCacheBuster ? { ftrCacheBuster } : {}), }, indexFilter ? JSON.stringify({ index_filter: indexFilter }) : undefined, forceRefresh diff --git a/src/plugins/data_views/server/rest_api_routes/internal/fields.ts b/src/plugins/data_views/server/rest_api_routes/internal/fields.ts index cee8efc8b6d1d..22407f629b448 100644 --- a/src/plugins/data_views/server/rest_api_routes/internal/fields.ts +++ b/src/plugins/data_views/server/rest_api_routes/internal/fields.ts @@ -137,10 +137,14 @@ export const registerFields = async ( >, isRollupsEnabled: () => boolean ) => { - router.versioned - .get({ path, access: 'internal', enableQueryVersion: true }) - .addVersion( - { version: '1', validate: { request: { query: querySchema }, response: validate.response } }, - handler(isRollupsEnabled) - ); + router.versioned.get({ path, access: 'internal', enableQueryVersion: true }).addVersion( + { + version: '1', + validate: { + request: { query: querySchema.extends({}, { unknowns: 'ignore' }) }, + response: validate.response, + }, + }, + handler(isRollupsEnabled) + ); }; diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 92b6a4eebf3a8..9f262a3a26de4 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -484,21 +484,8 @@ export class SettingsPageObject extends FtrService { } async refreshDataViewFieldList(dataViewName?: string) { - if (dataViewName) { - await this.common.navigateToApp('management/kibana/dataViews'); - await this.header.waitUntilLoadingHasFinished(); - await this.testSubjects.click(`detail-link-${dataViewName}`); - } - await this.testSubjects.click('refreshDataViewButton'); - - // wait for refresh to start - await new Promise((r) => setTimeout(r, 500)); - - // wait for refresh to finish - await this.retry.try(async () => { - const btn = await this.testSubjects.find('refreshDataViewButton'); - const disabled = await btn.getAttribute('disabled'); - expect(disabled).to.be(null); + await this.browser.execute(() => { + localStorage.setItem('dataViews:ftrCacheBuster', Date.now().toString()); }); } diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts index 0db9064f9cc4e..883eb1eec08c3 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts @@ -32,6 +32,7 @@ export default function (ctx: FtrProviderContext) { 'header', 'unifiedFieldList', 'settings', + 'settings', ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); @@ -448,20 +449,7 @@ export default function (ctx: FtrProviderContext) { it('allows to access only via a permitted index alias', async () => { await globalNav.badgeExistsOrFail('Read only'); - // can't access logstash index directly - // swapping index patterns so we get an updated field list - // this is necessary since we don't have access to data view management - // nor can we force reload the browser in a test - await new Promise((resolve) => setTimeout(resolve, 5000)); - await PageObjects.discover.selectIndexPattern('logstash-*'); - await new Promise((resolve) => setTimeout(resolve, 5000)); - await PageObjects.discover.selectIndexPattern('alias-logstash-discover'); - await new Promise((resolve) => setTimeout(resolve, 5000)); - await PageObjects.discover.selectIndexPattern('logstash-*'); - await new Promise((resolve) => setTimeout(resolve, 5000)); - await PageObjects.discover.selectIndexPattern('alias-logstash-discover'); - - await new Promise((resolve) => setTimeout(resolve, 5000)); + await PageObjects.settings.refreshDataViewFieldList(); await PageObjects.discover.selectIndexPattern('logstash-*'); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.existOrFail('discoverNoResultsCheckIndices');