diff --git a/packages/kbn-esql-utils/index.ts b/packages/kbn-esql-utils/index.ts index b4fc1f6548c69d..0d94e1f0c28a51 100644 --- a/packages/kbn-esql-utils/index.ts +++ b/packages/kbn-esql-utils/index.ts @@ -8,6 +8,7 @@ export { getESQLAdHocDataview, + getESQLAdHocDataviewLazy, getIndexPatternFromSQLQuery, getIndexPatternFromESQLQuery, getLimitFromESQLQuery, diff --git a/packages/kbn-esql-utils/src/index.ts b/packages/kbn-esql-utils/src/index.ts index f2e537a240f779..26300637d9bba6 100644 --- a/packages/kbn-esql-utils/src/index.ts +++ b/packages/kbn-esql-utils/src/index.ts @@ -7,7 +7,11 @@ */ export { TextBasedLanguages } from './types'; -export { getESQLAdHocDataview, getIndexForESQLQuery } from './utils/get_esql_adhoc_dataview'; +export { + getESQLAdHocDataview, + getESQLAdHocDataviewLazy, + getIndexForESQLQuery, +} from './utils/get_esql_adhoc_dataview'; export { getInitialESQLQuery } from './utils/get_initial_esql_query'; export { getIndexPatternFromSQLQuery, diff --git a/packages/kbn-esql-utils/src/utils/get_esql_adhoc_dataview.ts b/packages/kbn-esql-utils/src/utils/get_esql_adhoc_dataview.ts index e1e599946ef59a..d74cc5c67a8ce2 100644 --- a/packages/kbn-esql-utils/src/utils/get_esql_adhoc_dataview.ts +++ b/packages/kbn-esql-utils/src/utils/get_esql_adhoc_dataview.ts @@ -31,7 +31,30 @@ export async function getESQLAdHocDataview( indexPattern: string, dataViewsService: DataViewsPublicPluginStart ) { + const fld = await dataViewsService.getFieldsForWildcard({ + pattern: indexPattern, + fields: ['@timestamp'], + }); + return await dataViewsService.create({ + timeFieldName: fld.length > 0 ? '@timestamp' : undefined, + title: indexPattern, + type: ESQL_TYPE, + id: await sha256(`esql-${indexPattern}`), + }); +} + +export async function getESQLAdHocDataviewLazy( + indexPattern: string, + dataViewsService: DataViewsPublicPluginStart +) { + const fld = await dataViewsService.getFieldsForWildcard({ + pattern: indexPattern, + fields: ['@timestamp'], + }); + + return await dataViewsService.createDataViewLazy({ + timeFieldName: fld.length > 0 ? '@timestamp' : undefined, title: indexPattern, type: ESQL_TYPE, id: await sha256(`esql-${indexPattern}`), diff --git a/src/plugins/data_views/common/data_views/index.ts b/src/plugins/data_views/common/data_views/index.ts index f533a946e51e42..bfb5f34a1a85d7 100644 --- a/src/plugins/data_views/common/data_views/index.ts +++ b/src/plugins/data_views/common/data_views/index.ts @@ -10,4 +10,5 @@ export * from './flatten_hit'; export * from './data_view'; export * from './data_views'; export * from './data_view_lazy'; +export * from './abstract_data_views'; export { DataViewPersistableStateService } from './persistable_state'; diff --git a/src/plugins/data_views/common/index.ts b/src/plugins/data_views/common/index.ts index bed5c8c41251a9..2cae7dcbc4aa1f 100644 --- a/src/plugins/data_views/common/index.ts +++ b/src/plugins/data_views/common/index.ts @@ -69,7 +69,7 @@ export type { DataViewsServicePublicMethods, TimeBasedDataView, } from './data_views'; -export { DataView, DataViewLazy } from './data_views'; +export { DataView, DataViewLazy, AbstractDataView } from './data_views'; export { DuplicateDataViewError, DataViewSavedObjectConflictError, diff --git a/src/plugins/data_views/public/index.ts b/src/plugins/data_views/public/index.ts index 96380665548ddd..f3808cef2dacfa 100644 --- a/src/plugins/data_views/public/index.ts +++ b/src/plugins/data_views/public/index.ts @@ -47,7 +47,7 @@ export type { DataViewsServicePublic, DataViewsServicePublicDeps, } from './data_views_service_public'; -export { DataViewsApiClient, DataViewsService, DataView } from './data_views'; +export { DataViewsApiClient, DataViewsService, DataView, DataViewLazy } from './data_views'; export type { DataViewListItem } from './data_views'; export { UiSettingsPublicToCommon } from './ui_settings_wrapper'; diff --git a/src/plugins/discover/public/application/main/components/top_nav/on_save_search.tsx b/src/plugins/discover/public/application/main/components/top_nav/on_save_search.tsx index 84c056f60ad015..9d77281b6b19e6 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/on_save_search.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/on_save_search.tsx @@ -171,7 +171,7 @@ export async function onSaveSearch({ const saveModal = ( field.type === 'date'); const timeField = dataView?.timeFieldName || dateFields?.[0]?.name; const { triggersActionsUi } = services; diff --git a/src/plugins/discover/public/application/main/hooks/utils/build_state_subscribe.ts b/src/plugins/discover/public/application/main/hooks/utils/build_state_subscribe.ts index 305f67d61a0ae5..6e1889ec43bb07 100644 --- a/src/plugins/discover/public/application/main/hooks/utils/build_state_subscribe.ts +++ b/src/plugins/discover/public/application/main/hooks/utils/build_state_subscribe.ts @@ -96,7 +96,7 @@ export const buildStateSubscribe = appState.update({ index: nextDataView.id }, true); return; } - savedSearch.searchSource.setField('index', nextDataView); + savedSearch.searchSource.setField('index', await services.dataViews.toDataView(nextDataView)); dataState.reset(savedSearch); setDataView(nextDataView); savedSearchDataView = nextDataView; diff --git a/src/plugins/discover/public/application/main/hooks/utils/change_data_view.ts b/src/plugins/discover/public/application/main/hooks/utils/change_data_view.ts index 41a911295cacd7..e1485be39a274a 100644 --- a/src/plugins/discover/public/application/main/hooks/utils/change_data_view.ts +++ b/src/plugins/discover/public/application/main/hooks/utils/change_data_view.ts @@ -7,7 +7,7 @@ */ import { SortOrder } from '@kbn/saved-search-plugin/public'; -import { DataView } from '@kbn/data-views-plugin/common'; +import { DataViewLazy } from '@kbn/data-views-plugin/common'; import { MODIFY_COLUMNS_ON_SWITCH, SORT_DEFAULT_ORDER_SETTING, @@ -23,7 +23,7 @@ import { getDataViewAppState } from '../../utils/get_switch_data_view_app_state' * Function executed when switching data view in the UI */ export async function changeDataView( - id: string | DataView, + id: string | DataViewLazy, { services, internalState, @@ -38,19 +38,19 @@ export async function changeDataView( const { dataViews, uiSettings } = services; const dataView = internalState.getState().dataView; const state = appState.getState(); - let nextDataView: DataView | null = null; + let nextDataView: DataViewLazy | null = null; internalState.transitions.setIsDataViewLoading(true); try { - nextDataView = typeof id === 'string' ? await dataViews.get(id, false) : id; + nextDataView = typeof id === 'string' ? await dataViews.getDataViewLazy(id) : id; } catch (e) { // } if (nextDataView && dataView) { const nextAppState = getDataViewAppState( - dataView, - nextDataView, + await services.dataViews.toDataView(dataView), + await services.dataViews.toDataView(nextDataView), uiSettings.get(DEFAULT_COLUMNS_SETTING, []), state.columns || [], (state.sort || []) as SortOrder[], diff --git a/src/plugins/discover/public/application/main/services/discover_data_state_container.ts b/src/plugins/discover/public/application/main/services/discover_data_state_container.ts index b2f8ae9f0a81de..af1998a73090d8 100644 --- a/src/plugins/discover/public/application/main/services/discover_data_state_container.ts +++ b/src/plugins/discover/public/application/main/services/discover_data_state_container.ts @@ -12,7 +12,7 @@ import { RequestAdapter } from '@kbn/inspector-plugin/common'; import { SavedSearch } from '@kbn/saved-search-plugin/public'; import { AggregateQuery, Query } from '@kbn/es-query'; import type { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; -import { DataView } from '@kbn/data-views-plugin/common'; +import { DataViewLazy } from '@kbn/data-views-plugin/common'; import { reportPerformanceMetricEvent } from '@kbn/ebt-tools'; import type { SearchResponseWarning } from '@kbn/search-response-warnings'; import type { DataTableRecord } from '@kbn/discover-utils/types'; @@ -163,7 +163,7 @@ export function getDataStateContainer({ getAppState: () => DiscoverAppState; getInternalState: () => InternalState; getSavedSearch: () => SavedSearch; - setDataView: (dataView: DataView) => void; + setDataView: (dataView: DataViewLazy) => void; }): DiscoverDataStateContainer { const { data, uiSettings, toastNotifications } = services; const { timefilter } = data.query.timefilter; @@ -298,7 +298,9 @@ export function getDataStateContainer({ const fetchQuery = async (resetQuery?: boolean) => { const query = getAppState().query; - const currentDataView = getSavedSearch().searchSource.getField('index'); + const savedSearchDataView = getSavedSearch().searchSource.getField('index'); + const currentDataView = + savedSearchDataView && (await services.dataViews.toDataViewLazy(savedSearchDataView)); if (isTextBasedQuery(query)) { const nextDataView = await getDataViewByTextBasedQueryLang(query, currentDataView, services); diff --git a/src/plugins/discover/public/application/main/services/discover_internal_state_container.ts b/src/plugins/discover/public/application/main/services/discover_internal_state_container.ts index 5825e4d2cef6c4..d28fa0f464ceae 100644 --- a/src/plugins/discover/public/application/main/services/discover_internal_state_container.ts +++ b/src/plugins/discover/public/application/main/services/discover_internal_state_container.ts @@ -11,31 +11,31 @@ import { createStateContainerReactHelpers, ReduxLikeStateContainer, } from '@kbn/kibana-utils-plugin/common'; -import { DataView, DataViewListItem } from '@kbn/data-views-plugin/common'; +import { DataViewLazy, DataViewListItem } from '@kbn/data-views-plugin/common'; import { Filter } from '@kbn/es-query'; import type { DataTableRecord } from '@kbn/discover-utils/types'; export interface InternalState { - dataView: DataView | undefined; + dataView: DataViewLazy | undefined; isDataViewLoading: boolean; savedDataViews: DataViewListItem[]; - adHocDataViews: DataView[]; + adHocDataViews: DataViewLazy[]; expandedDoc: DataTableRecord | undefined; customFilters: Filter[]; } export interface InternalStateTransitions { - setDataView: (state: InternalState) => (dataView: DataView) => InternalState; + setDataView: (state: InternalState) => (dataView: DataViewLazy) => InternalState; setIsDataViewLoading: (state: InternalState) => (isLoading: boolean) => InternalState; setSavedDataViews: (state: InternalState) => (dataView: DataViewListItem[]) => InternalState; - setAdHocDataViews: (state: InternalState) => (dataViews: DataView[]) => InternalState; + setAdHocDataViews: (state: InternalState) => (dataViews: DataViewLazy[]) => InternalState; appendAdHocDataViews: ( state: InternalState - ) => (dataViews: DataView | DataView[]) => InternalState; + ) => (dataViews: DataViewLazy | DataViewLazy[]) => InternalState; removeAdHocDataViewById: (state: InternalState) => (id: string) => InternalState; replaceAdHocDataViewWithId: ( state: InternalState - ) => (id: string, dataView: DataView) => InternalState; + ) => (id: string, dataView: DataViewLazy) => InternalState; setExpandedDoc: ( state: InternalState ) => (dataView: DataTableRecord | undefined) => InternalState; @@ -61,7 +61,7 @@ export function getInternalStateContainer() { customFilters: [], }, { - setDataView: (prevState: InternalState) => (nextDataView: DataView) => ({ + setDataView: (prevState: InternalState) => (nextDataView: DataViewLazy) => ({ ...prevState, dataView: nextDataView, }), @@ -73,17 +73,17 @@ export function getInternalStateContainer() { ...prevState, savedDataViews: nextDataViewList, }), - setAdHocDataViews: (prevState: InternalState) => (newAdHocDataViewList: DataView[]) => ({ + setAdHocDataViews: (prevState: InternalState) => (newAdHocDataViewList: DataViewLazy[]) => ({ ...prevState, adHocDataViews: newAdHocDataViewList, }), appendAdHocDataViews: - (prevState: InternalState) => (dataViewsAdHoc: DataView | DataView[]) => { + (prevState: InternalState) => (dataViewsAdHoc: DataViewLazy | DataViewLazy[]) => { // check for already existing data views const concatList = ( Array.isArray(dataViewsAdHoc) ? dataViewsAdHoc : [dataViewsAdHoc] ).filter((dataView) => { - return !prevState.adHocDataViews.find((el: DataView) => el.id === dataView.id); + return !prevState.adHocDataViews.find((el: DataViewLazy) => el.id === dataView.id); }); if (!concatList.length) { return prevState; @@ -98,7 +98,7 @@ export function getInternalStateContainer() { adHocDataViews: prevState.adHocDataViews.filter((dataView) => dataView.id !== id), }), replaceAdHocDataViewWithId: - (prevState: InternalState) => (prevId: string, newDataView: DataView) => ({ + (prevState: InternalState) => (prevId: string, newDataView: DataViewLazy) => ({ ...prevState, adHocDataViews: prevState.adHocDataViews.map((dataView) => dataView.id === prevId ? newDataView : dataView diff --git a/src/plugins/discover/public/application/main/services/discover_saved_search_container.ts b/src/plugins/discover/public/application/main/services/discover_saved_search_container.ts index ecae2208bffccb..913bf5e4cde08e 100644 --- a/src/plugins/discover/public/application/main/services/discover_saved_search_container.ts +++ b/src/plugins/discover/public/application/main/services/discover_saved_search_container.ts @@ -11,7 +11,7 @@ import { BehaviorSubject } from 'rxjs'; import { cloneDeep } from 'lodash'; import { COMPARE_ALL_OPTIONS, FilterCompareOptions } from '@kbn/es-query'; import type { SearchSourceFields } from '@kbn/data-plugin/common'; -import type { DataView } from '@kbn/data-views-plugin/common'; +import type { DataViewLazy, DataView } from '@kbn/data-views-plugin/common'; import { SavedObjectSaveOpts } from '@kbn/saved-objects-plugin/public'; import { isEqual, isFunction } from 'lodash'; import { restoreStateFromSavedSearch } from '../../../services/saved_searches/restore_from_saved_search'; @@ -32,7 +32,7 @@ export interface UpdateParams { /** * The next data view to be used */ - nextDataView?: DataView | undefined; + nextDataView?: DataViewLazy | undefined; /** * The next AppState that should be used for updating the saved search */ @@ -110,7 +110,7 @@ export interface DiscoverSavedSearchContainer { * Updates the current state of the saved search * @param params */ - update: (params: UpdateParams) => SavedSearch; + update: (params: UpdateParams) => Promise; /** * Passes filter manager filters to saved search filters * @param params @@ -195,17 +195,19 @@ export function getSavedSearchContainer({ return nextSavedSearch; }; - const update = ({ nextDataView, nextState, useFilterAndQueryServices }: UpdateParams) => { + const update = async ({ nextDataView, nextState, useFilterAndQueryServices }: UpdateParams) => { addLog('[savedSearch] update', { nextDataView, nextState }); const previousSavedSearch = getState(); const dataView = nextDataView ? nextDataView - : previousSavedSearch.searchSource.getField('index')!; + : await services.dataViews.toDataViewLazy( + previousSavedSearch.searchSource.getField('index')! + ); const nextSavedSearch = updateSavedSearch({ savedSearch: { ...previousSavedSearch }, - dataView, + dataView: await services.dataViews.toDataView(dataView), state: nextState || {}, globalStateContainer, services, diff --git a/src/plugins/discover/public/application/main/services/discover_state.ts b/src/plugins/discover/public/application/main/services/discover_state.ts index 07db2d90857daa..6f3ef4bfebe81a 100644 --- a/src/plugins/discover/public/application/main/services/discover_state.ts +++ b/src/plugins/discover/public/application/main/services/discover_state.ts @@ -19,7 +19,7 @@ import { noSearchSessionStorageCapabilityMessage, SearchSessionInfoProvider, } from '@kbn/data-plugin/public'; -import { DataView, DataViewSpec, DataViewType } from '@kbn/data-views-plugin/public'; +import { DataViewLazy, DataViewSpec, DataViewType } from '@kbn/data-views-plugin/public'; import type { SavedSearch } from '@kbn/saved-search-plugin/public'; import { v4 as uuidv4 } from 'uuid'; import { merge } from 'rxjs'; @@ -86,7 +86,7 @@ export interface LoadParams { /** * the data view to use, if undefined, the saved search's data view will be used */ - dataView?: DataView; + dataView?: DataViewLazy; /** * Custom initial app state for loading a saved search */ @@ -158,17 +158,17 @@ export interface DiscoverStateContainer { * Used by the Data View Picker * @param pattern */ - createAndAppendAdHocDataView: (dataViewSpec: DataViewSpec) => Promise; + createAndAppendAdHocDataView: (dataViewSpec: DataViewSpec) => Promise; /** * Triggered when a new data view is created * @param dataView */ - onDataViewCreated: (dataView: DataView) => Promise; + onDataViewCreated: (dataView: DataViewLazy) => Promise; /** * Triggered when a new data view is edited * @param dataView */ - onDataViewEdited: (dataView: DataView) => Promise; + onDataViewEdited: (dataView: DataViewLazy) => Promise; /** * Triggered when a saved search is opened in the savedObject finder * @param savedSearchId @@ -187,12 +187,12 @@ export interface DiscoverStateContainer { * Triggered when the user selects a different data view in the data view picker * @param id - id of the data view */ - onChangeDataView: (id: string | DataView) => Promise; + onChangeDataView: (id: string | DataViewLazy) => Promise; /** * Set the currently selected data view * @param dataView */ - setDataView: (dataView: DataView) => void; + setDataView: (dataView: DataViewLazy) => void; /** * Undo changes made to the saved search, e.g. when the user triggers the "Reset search" button */ @@ -201,7 +201,7 @@ export interface DiscoverStateContainer { * When saving a saved search with an ad hoc data view, a new id needs to be generated for the data view * This is to prevent duplicate ids messing with our system */ - updateAdHocDataViewId: () => Promise; + updateAdHocDataViewId: () => Promise; }; } @@ -265,7 +265,7 @@ export function getDiscoverStateContainer({ */ const internalStateContainer = getInternalStateContainer(); - const pauseAutoRefreshInterval = async (dataView: DataView) => { + const pauseAutoRefreshInterval = async (dataView: DataViewLazy) => { if (dataView && (!dataView.isTimeBased() || dataView.type === DataViewType.ROLLUP)) { const state = globalStateContainer.get(); if (state?.refreshInterval && !state.refreshInterval.pause) { @@ -276,10 +276,12 @@ export function getDiscoverStateContainer({ } } }; - const setDataView = (dataView: DataView) => { + const setDataView = async (dataView: DataViewLazy) => { internalStateContainer.transitions.setDataView(dataView); pauseAutoRefreshInterval(dataView); - savedSearchContainer.getState().searchSource.setField('index', dataView); + savedSearchContainer + .getState() + .searchSource.setField('index', await services.dataViews.toDataView(dataView)); }; const dataStateContainer = getDataStateContainer({ @@ -303,7 +305,10 @@ export function getDiscoverStateContainer({ const updateAdHocDataViewId = async () => { const prevDataView = internalStateContainer.getState().dataView; if (!prevDataView || prevDataView.isPersisted()) return; - const newDataView = await services.dataViews.create({ ...prevDataView.toSpec(), id: uuidv4() }); + const newDataView = await services.dataViews.createDataViewLazy({ + ...prevDataView.toSpec(), + id: uuidv4(), + }); services.dataViews.clearInstanceCache(prevDataView.id); updateFiltersReferences({ @@ -334,7 +339,7 @@ export function getDiscoverStateContainer({ } }; - const onDataViewCreated = async (nextDataView: DataView) => { + const onDataViewCreated = async (nextDataView: DataViewLazy) => { if (!nextDataView.isPersisted()) { internalStateContainer.transitions.appendAdHocDataViews(nextDataView); } else { @@ -345,12 +350,12 @@ export function getDiscoverStateContainer({ } }; - const onDataViewEdited = async (editedDataView: DataView) => { + const onDataViewEdited = async (editedDataView: DataViewLazy) => { if (editedDataView.isPersisted()) { // Clear the current data view from the cache and create a new instance // of it, ensuring we have a new object reference to trigger a re-render services.dataViews.clearInstanceCache(editedDataView.id); - setDataView(await services.dataViews.create(editedDataView.toSpec(), true)); + setDataView(await services.dataViews.createDataViewLazy(await editedDataView.toSpec())); } else { await updateAdHocDataViewId(); } @@ -430,10 +435,7 @@ export function getDiscoverStateContainer({ }; const createAndAppendAdHocDataView = async (dataViewSpec: DataViewSpec) => { - const newDataView = await services.dataViews.create(dataViewSpec); - if (newDataView.fields.getByName('@timestamp')?.type === 'date') { - newDataView.timeFieldName = '@timestamp'; - } + const newDataView = await services.dataViews.createDataViewLazy(dataViewSpec); internalStateContainer.transitions.appendAdHocDataViews(newDataView); await onChangeDataView(newDataView); @@ -457,7 +459,7 @@ export function getDiscoverStateContainer({ /** * Function e.g. triggered when user changes data view in the sidebar */ - const onChangeDataView = async (id: string | DataView) => { + const onChangeDataView = async (id: string | DataViewLazy) => { await changeDataView(id, { services, internalState: internalStateContainer, diff --git a/src/plugins/discover/public/application/main/services/load_saved_search.ts b/src/plugins/discover/public/application/main/services/load_saved_search.ts index d5a5be0935d8cb..435866bb10ace4 100644 --- a/src/plugins/discover/public/application/main/services/load_saved_search.ts +++ b/src/plugins/discover/public/application/main/services/load_saved_search.ts @@ -60,7 +60,9 @@ export const loadSavedSearch = async ( let nextSavedSearch = savedSearchId ? await savedSearchContainer.load(savedSearchId) : await savedSearchContainer.new( - await getStateDataView(params, { services, appState, internalStateContainer }) + await services.dataViews.toDataView( + await getStateDataView(params, { services, appState, internalStateContainer }) + ) ); // Cleaning up the previous state @@ -100,11 +102,16 @@ export const loadSavedSearch = async ( stateDataView && (dataViewDifferentToAppState || !savedSearchDataViewId) ) { - nextSavedSearch.searchSource.setField('index', stateDataView); + nextSavedSearch.searchSource.setField( + 'index', + await services.dataViews.toDataView(stateDataView) + ); } } - nextSavedSearch = savedSearchContainer.update({ - nextDataView: nextSavedSearch.searchSource.getField('index'), + nextSavedSearch = await savedSearchContainer.update({ + nextDataView: + nextSavedSearch.searchSource.getField('index') && + (await services.dataViews.toDataViewLazy(nextSavedSearch.searchSource.getField('index')!)), nextState: appState, }); } @@ -132,9 +139,11 @@ export const loadSavedSearch = async ( * @param savedSearch * @param deps */ -function updateBySavedSearch(savedSearch: SavedSearch, deps: LoadSavedSearchDeps) { +async function updateBySavedSearch(savedSearch: SavedSearch, deps: LoadSavedSearchDeps) { const { dataStateContainer, internalStateContainer, services, setDataView } = deps; - const savedSearchDataView = savedSearch.searchSource.getField('index')!; + const savedSearchDataView = await services.dataViews.toDataViewLazy( + savedSearch.searchSource.getField('index')! + ); setDataView(savedSearchDataView); if (!savedSearchDataView.isPersisted()) { diff --git a/src/plugins/discover/public/application/main/utils/get_data_view_by_text_based_query_lang.ts b/src/plugins/discover/public/application/main/utils/get_data_view_by_text_based_query_lang.ts index 42e36c7ac9ab8b..4bdf58000246ed 100644 --- a/src/plugins/discover/public/application/main/utils/get_data_view_by_text_based_query_lang.ts +++ b/src/plugins/discover/public/application/main/utils/get_data_view_by_text_based_query_lang.ts @@ -7,16 +7,16 @@ */ import type { AggregateQuery } from '@kbn/es-query'; import { - getESQLAdHocDataview, + getESQLAdHocDataviewLazy, getIndexPatternFromSQLQuery, getIndexPatternFromESQLQuery, } from '@kbn/esql-utils'; -import { DataView } from '@kbn/data-views-plugin/common'; +import { DataViewLazy } from '@kbn/data-views-plugin/common'; import { DiscoverServices } from '../../../build_services'; export async function getDataViewByTextBasedQueryLang( query: AggregateQuery, - currentDataView: DataView | undefined, + currentDataView: DataViewLazy | undefined, services: DiscoverServices ) { let indexPatternFromQuery = ''; @@ -33,12 +33,7 @@ export async function getDataViewByTextBasedQueryLang( currentDataView?.isPersisted() || indexPatternFromQuery !== currentDataView?.getIndexPattern() ) { - const dataViewObj = await getESQLAdHocDataview(indexPatternFromQuery, services.dataViews); - - if (dataViewObj.fields.getByName('@timestamp')?.type === 'date') { - dataViewObj.timeFieldName = '@timestamp'; - } - return dataViewObj; + return await getESQLAdHocDataviewLazy(indexPatternFromQuery, services.dataViews); } return currentDataView; } diff --git a/src/plugins/discover/public/application/main/utils/resolve_data_view.ts b/src/plugins/discover/public/application/main/utils/resolve_data_view.ts index 761fb9764c82fe..3a6592ebfe666a 100644 --- a/src/plugins/discover/public/application/main/utils/resolve_data_view.ts +++ b/src/plugins/discover/public/application/main/utils/resolve_data_view.ts @@ -7,7 +7,12 @@ */ import { i18n } from '@kbn/i18n'; -import type { DataView, DataViewListItem, DataViewSpec } from '@kbn/data-views-plugin/public'; +import type { + DataView, + DataViewLazy, + DataViewListItem, + DataViewSpec, +} from '@kbn/data-views-plugin/public'; import type { ToastsStart } from '@kbn/core/public'; import { SavedSearch } from '@kbn/saved-search-plugin/public'; import { DiscoverInternalStateContainer } from '../services/discover_internal_state_container'; @@ -20,7 +25,7 @@ interface DataViewData { /** * Loaded data view (might be default data view if requested was not found) */ - loaded: DataView; + loaded: DataViewLazy; /** * Id of the requested data view */ @@ -55,7 +60,7 @@ export async function loadDataView({ if (dataViewSpec) { const isPersisted = dataViewList.find(({ id: currentId }) => currentId === dataViewSpec.id); if (!isPersisted) { - const createdAdHocDataView = await dataViews.create(dataViewSpec); + const createdAdHocDataView = await dataViews.createDataViewLazy(dataViewSpec); return { list: dataViewList || [], loaded: createdAdHocDataView, @@ -67,10 +72,10 @@ export async function loadDataView({ fetchId = dataViewSpec.id!; } - let fetchedDataView: DataView | null = null; + let fetchedDataView: DataViewLazy | null = null; // try to fetch adhoc data view first try { - fetchedDataView = fetchId ? await dataViews.get(fetchId) : null; + fetchedDataView = fetchId ? await dataViews.getDataViewLazy(fetchId) : null; if (fetchedDataView && !fetchedDataView.isPersisted()) { return { list: dataViewList || [], @@ -85,13 +90,10 @@ export async function loadDataView({ // eslint-disable-next-line no-empty } catch (e) {} - let defaultDataView: DataView | null = null; + let defaultDataView: DataViewLazy | null = null; if (!fetchedDataView) { try { - defaultDataView = await dataViews.getDefaultDataView({ - displayErrors: false, - refreshFields: true, - }); + defaultDataView = await dataViews.getDefaultDataViewLazy(); } catch (e) { // } @@ -115,6 +117,7 @@ export function resolveDataView( ip: DataViewData, savedSearch: SavedSearch | undefined, toastNotifications: ToastsStart, + dataViewToDataViewLazy: (dataView: DataView) => Promise, isTextBasedQuery?: boolean ) { const { loaded: loadedDataView, stateVal, stateValFound } = ip; @@ -123,7 +126,7 @@ export function resolveDataView( if (ownDataView && !stateVal) { // the given saved search has its own data view, and no data view was specified in the URL - return ownDataView; + return dataViewToDataViewLazy(ownDataView); } // no warnings for text based mode @@ -148,7 +151,7 @@ export function resolveDataView( }), 'data-test-subj': 'dscDataViewNotFoundShowSavedWarning', }); - return ownDataView; + return dataViewToDataViewLazy(ownDataView); } toastNotifications.addWarning({ title: warningTitle, @@ -194,10 +197,11 @@ export const loadAndResolveDataView = async ( dataViewSpec, dataViewList: savedDataViews, }); - const nextDataView = resolveDataView( + const nextDataView = await resolveDataView( nextDataViewData, savedSearch, services.toastNotifications, + services.dataViews.toDataViewLazy, isTextBasedQuery ); return { fallback: !nextDataViewData.stateValFound, dataView: nextDataView }; diff --git a/src/plugins/discover/public/application/main/utils/update_filter_references.ts b/src/plugins/discover/public/application/main/utils/update_filter_references.ts index 2017e2d41ed921..c4f4c3f15a0cae 100644 --- a/src/plugins/discover/public/application/main/utils/update_filter_references.ts +++ b/src/plugins/discover/public/application/main/utils/update_filter_references.ts @@ -11,7 +11,7 @@ import { UPDATE_FILTER_REFERENCES_TRIGGER, } from '@kbn/unified-search-plugin/public'; import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; -import type { DataView } from '@kbn/data-views-plugin/public'; +import type { DataViewLazy } from '@kbn/data-views-plugin/public'; import { DiscoverServices } from '../../../build_services'; export const updateFiltersReferences = ({ @@ -19,8 +19,8 @@ export const updateFiltersReferences = ({ nextDataView, services: { uiActions }, }: { - prevDataView: DataView; - nextDataView: DataView; + prevDataView: DataViewLazy; + nextDataView: DataViewLazy; services: DiscoverServices; }) => { const trigger = uiActions.getTrigger(UPDATE_FILTER_REFERENCES_TRIGGER); diff --git a/src/plugins/discover/public/utils/get_valid_filters.ts b/src/plugins/discover/public/utils/get_valid_filters.ts index 2d43262efc1968..11f98a4e087e83 100644 --- a/src/plugins/discover/public/utils/get_valid_filters.ts +++ b/src/plugins/discover/public/utils/get_valid_filters.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { DataView } from '@kbn/data-views-plugin/common'; +import { AbstractDataView } from '@kbn/data-views-plugin/common'; import { Filter } from '@kbn/es-query'; -export const getValidFilters = (dataView: DataView, filters: Filter[]): Filter[] => { +export const getValidFilters = (dataView: AbstractDataView, filters: Filter[]): Filter[] => { return filters.map((filter) => { const meta = { ...filter.meta }; diff --git a/test/functional/fixtures/kbn_archiver/discover.json b/test/functional/fixtures/kbn_archiver/discover.json deleted file mode 100644 index e861f875a2d9e1..00000000000000 --- a/test/functional/fixtures/kbn_archiver/discover.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "attributes": { - "fieldAttrs": "{\"referer\":{\"customLabel\":\"Referer custom\"}}", - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"@message\"}}},{\"name\":\"@tags\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"@tags\"}}},{\"name\":\"@timestamp\",\"type\":\"date\",\"esTypes\":[\"date\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"esTypes\":[\"_id\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"esTypes\":[\"_index\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"esTypes\":[\"_source\"],\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"agent\"}}},{\"name\":\"bytes\",\"type\":\"number\",\"esTypes\":[\"long\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"extension\"}}},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"headings\"}}},{\"name\":\"host\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"host\"}}},{\"name\":\"id\",\"type\":\"number\",\"esTypes\":[\"integer\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"index\"}}},{\"name\":\"ip\",\"type\":\"ip\",\"esTypes\":[\"ip\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"links\"}}},{\"name\":\"machine.os\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"machine.os\"}}},{\"name\":\"machine.ram\",\"type\":\"number\",\"esTypes\":[\"long\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"esTypes\":[\"double\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"esTypes\":[\"integer\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"nestedField.child\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"nested\":{\"path\":\"nestedField\"}}},{\"name\":\"phpmemory\",\"type\":\"number\",\"esTypes\":[\"long\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"esTypes\":[\"date\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"esTypes\":[\"date\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.article:section\"}}},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.article:tag\"}}},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:description\"}}},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:image\"}}},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:image:height\"}}},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:image:width\"}}},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:site_name\"}}},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:title\"}}},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:type\"}}},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.og:url\"}}},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.twitter:card\"}}},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.twitter:description\"}}},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.twitter:image\"}}},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.twitter:site\"}}},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.twitter:title\"}}},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"relatedContent.url\"}}},{\"name\":\"request\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"request\"}}},{\"name\":\"response\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"response\"}}},{\"name\":\"spaces\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"spaces\"}}},{\"name\":\"type\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"url\"}}},{\"name\":\"utc_time\",\"type\":\"date\",\"esTypes\":[\"date\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"esTypes\":[\"text\"],\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"esTypes\":[\"keyword\"],\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true,\"subType\":{\"multi\":{\"parent\":\"xss\"}}}]", - "timeFieldName": "@timestamp", - "title": "logstash-*" - }, - "coreMigrationVersion": "8.0.0", - "id": "logstash-*", - "migrationVersion": { - "index-pattern": "7.11.0" - }, - "references": [], - "type": "index-pattern", - "version": "WzQsMl0=" -} - -{ - "attributes": { - "columns": [ - "_source" - ], - "description": "A Saved Search Description", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"highlightAll\":true,\"filter\":[],\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" - }, - "sort": [ - [ - "@timestamp", - "desc" - ] - ], - "title": "A Saved Search", - "version": 1 - }, - "coreMigrationVersion": "8.0.0", - "id": "ab12e3c0-f231-11e6-9486-733b1ac9221a", - "migrationVersion": { - "search": "7.9.3" - }, - "references": [ - { - "id": "logstash-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "search", - "version": "WzUsMl0=" -} \ No newline at end of file