diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index ce6f2e03744fa..02480aded9655 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -18,7 +18,7 @@ export * from './deprecated'; * Filters: */ -export { getEsQueryConfig } from '../common'; +export { getEsQueryConfig, FilterStateStore } from '../common'; export { FilterLabel, FilterItem } from './ui'; export { getDisplayValueFromFilter, generateFilters, extractTimeRange } from './query'; @@ -201,13 +201,13 @@ export { SEARCH_SESSIONS_MANAGEMENT_ID, waitUntilNextSessionCompletes$, isEsError, + SearchSource, SearchSessionState, SortDirection, handleResponse, } from './search'; export type { - SearchSource, // TODO: remove these when data_enhanced is merged into data ISessionService, SearchSessionInfoProvider, @@ -294,7 +294,9 @@ export type { AggsStart } from './search/aggs'; export { getTime } from '../common'; -export { isTimeRange, isQuery } from '../common'; +export type { SavedObject } from '../common'; + +export { isTimeRange, isQuery, flattenHit, calculateBounds, tabifyAggResponse } from '../common'; export type { ApplyGlobalFilterActionContext } from './actions'; export { ACTION_GLOBAL_APPLY_FILTER } from './actions'; diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 87c41cf76a359..449d18b542300 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -14,7 +14,7 @@ import { ConfigSchema, configSchema } from '../config'; import { DataServerPlugin, DataPluginSetup, DataPluginStart } from './plugin'; export * from './deprecated'; -export { getEsQueryConfig } from '../common'; +export { getEsQueryConfig, DEFAULT_QUERY_LANGUAGE } from '../common'; /** * Exporters (CSV) diff --git a/src/plugins/data_views/public/index.ts b/src/plugins/data_views/public/index.ts index 2a9f1201cc854..47bbbe0406a90 100644 --- a/src/plugins/data_views/public/index.ts +++ b/src/plugins/data_views/public/index.ts @@ -16,13 +16,16 @@ export { export { onRedirectNoIndexPattern } from './data_views'; export type { IIndexPatternFieldList, TypeMeta, RuntimeType } from '../common'; -export type { DataViewSpec } from '../common'; +export type { DataViewSpec, FieldSpec, DataViewAttributes } from '../common'; export { IndexPatternField, DataViewField, DataViewType, + DataViewSavedObjectConflictError, META_FIELDS, DATA_VIEW_SAVED_OBJECT_TYPE, + getFieldSubtypeMulti, + getFieldSubtypeNested, } from '../common'; export type { IndexPatternsContract } from './data_views'; diff --git a/src/plugins/discover/public/__mocks__/index_pattern.ts b/src/plugins/discover/public/__mocks__/index_pattern.ts index 21c6ab7baae41..becaa9934afce 100644 --- a/src/plugins/discover/public/__mocks__/index_pattern.ts +++ b/src/plugins/discover/public/__mocks__/index_pattern.ts @@ -6,8 +6,7 @@ * Side Public License, v 1. */ -import { IIndexPatternFieldList } from '../../../data/common'; -import { DataView } from '../../../data/common'; +import { IIndexPatternFieldList, DataView } from '../../../data_views/public'; const fields = [ { diff --git a/src/plugins/discover/public/__mocks__/index_pattern_with_timefield.ts b/src/plugins/discover/public/__mocks__/index_pattern_with_timefield.ts index 027b3f629dd22..01f3f537f0745 100644 --- a/src/plugins/discover/public/__mocks__/index_pattern_with_timefield.ts +++ b/src/plugins/discover/public/__mocks__/index_pattern_with_timefield.ts @@ -6,8 +6,7 @@ * Side Public License, v 1. */ -import { IIndexPatternFieldList } from '../../../data/common'; -import { DataView } from '../../../data/common'; +import { IIndexPatternFieldList, DataView } from '../../../data_views/public'; const fields = [ { diff --git a/src/plugins/discover/public/__mocks__/services.ts b/src/plugins/discover/public/__mocks__/services.ts index e0a76a8617135..bc66ae363711e 100644 --- a/src/plugins/discover/public/__mocks__/services.ts +++ b/src/plugins/discover/public/__mocks__/services.ts @@ -17,7 +17,7 @@ import { SAMPLE_SIZE_SETTING, SORT_DEFAULT_ORDER_SETTING, } from '../../common'; -import { UI_SETTINGS } from '../../../data/common'; +import { UI_SETTINGS } from '../../../data/public'; import { TopNavMenu } from '../../../navigation/public'; import { FORMATS_UI_SETTINGS } from 'src/plugins/field_formats/common'; import { LocalStorageMock } from './local_storage_mock'; diff --git a/src/plugins/discover/public/application/context/context_app.tsx b/src/plugins/discover/public/application/context/context_app.tsx index dcf1c6b11e68e..d2ec535a6ed2c 100644 --- a/src/plugins/discover/public/application/context/context_app.tsx +++ b/src/plugins/discover/public/application/context/context_app.tsx @@ -14,7 +14,7 @@ import { EuiText, EuiPageContent, EuiPage, EuiSpacer } from '@elastic/eui'; import { cloneDeep } from 'lodash'; import { DOC_TABLE_LEGACY, SEARCH_FIELDS_FROM_SOURCE } from '../../../common'; import { ContextErrorMessage } from './components/context_error_message'; -import { DataView, DataViewField } from '../../../../data/common'; +import { DataView, DataViewField } from '../../../../data_views/public'; import { LoadingStatus } from './services/context_query_state'; import { AppState, isEqualFilters } from './services/context_state'; import { useColumns } from '../../utils/use_data_grid_columns'; diff --git a/src/plugins/discover/public/application/context/context_app_content.test.tsx b/src/plugins/discover/public/application/context/context_app_content.test.tsx index e57206bcba2c1..c25df457807c2 100644 --- a/src/plugins/discover/public/application/context/context_app_content.test.tsx +++ b/src/plugins/discover/public/application/context/context_app_content.test.tsx @@ -11,7 +11,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { ActionBar } from './components/action_bar/action_bar'; import { GetStateReturn } from './services/context_state'; -import { SortDirection } from 'src/plugins/data/common'; +import { SortDirection } from 'src/plugins/data/public'; import { ContextAppContent, ContextAppContentProps } from './context_app_content'; import { LoadingStatus } from './services/context_query_state'; import { indexPatternMock } from '../../__mocks__/index_pattern'; diff --git a/src/plugins/discover/public/application/context/context_app_content.tsx b/src/plugins/discover/public/application/context/context_app_content.tsx index 67efd36f1bc7c..ffd6b3540b855 100644 --- a/src/plugins/discover/public/application/context/context_app_content.tsx +++ b/src/plugins/discover/public/application/context/context_app_content.tsx @@ -10,7 +10,8 @@ import React, { useState, Fragment, useMemo, useCallback } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiHorizontalRule, EuiText } from '@elastic/eui'; import { CONTEXT_STEP_SETTING, DOC_HIDE_TIME_COLUMN_SETTING } from '../../../common'; -import { DataView, SortDirection } from '../../../../data/common'; +import type { DataView } from '../../../../data_views/public'; +import { SortDirection } from '../../../../data/public'; import { LoadingStatus } from './services/context_query_state'; import { ActionBar } from './components/action_bar/action_bar'; import { DiscoverGrid } from '../../components/discover_grid/discover_grid'; diff --git a/src/plugins/discover/public/application/context/services/anchor.test.ts b/src/plugins/discover/public/application/context/services/anchor.test.ts index 2a1b2809c6870..12c7c2c0ccb40 100644 --- a/src/plugins/discover/public/application/context/services/anchor.test.ts +++ b/src/plugins/discover/public/application/context/services/anchor.test.ts @@ -5,8 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - -import { DataView, SortDirection } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; +import { SortDirection } from '../../../../../data/public'; import { createSearchSourceStub } from './_stubs'; import { fetchAnchor, updateSearchSource } from './anchor'; import { indexPatternMock } from '../../../__mocks__/index_pattern'; diff --git a/src/plugins/discover/public/application/context/services/anchor.ts b/src/plugins/discover/public/application/context/services/anchor.ts index 2cab92be4ce57..90268c094d91a 100644 --- a/src/plugins/discover/public/application/context/services/anchor.ts +++ b/src/plugins/discover/public/application/context/services/anchor.ts @@ -7,8 +7,8 @@ */ import { i18n } from '@kbn/i18n'; - -import { ISearchSource, EsQuerySortValue, DataView } from '../../../../../data/common'; +import { ISearchSource, EsQuerySortValue } from '../../../../../data/public'; +import { DataView } from '../../../../../data_views/public'; import { EsHitRecord } from '../../types'; export async function fetchAnchor( diff --git a/src/plugins/discover/public/application/context/services/context.predecessors.test.ts b/src/plugins/discover/public/application/context/services/context.predecessors.test.ts index 136a2cb0a3acc..c5aaf7f68b9a5 100644 --- a/src/plugins/discover/public/application/context/services/context.predecessors.test.ts +++ b/src/plugins/discover/public/application/context/services/context.predecessors.test.ts @@ -8,7 +8,8 @@ import moment from 'moment'; import { get, last } from 'lodash'; -import { DataView, SortDirection } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; +import { SortDirection } from 'src/plugins/data/public'; import { createContextSearchSourceStub } from './_stubs'; import { fetchSurroundingDocs, SurrDocType } from './context'; import { DataPublicPluginStart, Query } from '../../../../../data/public'; diff --git a/src/plugins/discover/public/application/context/services/context.successors.test.ts b/src/plugins/discover/public/application/context/services/context.successors.test.ts index d9736498bf66e..9fc53de86840b 100644 --- a/src/plugins/discover/public/application/context/services/context.successors.test.ts +++ b/src/plugins/discover/public/application/context/services/context.successors.test.ts @@ -8,7 +8,8 @@ import moment from 'moment'; import { get, last } from 'lodash'; -import { DataView, SortDirection } from 'src/plugins/data/common'; +import { SortDirection } from 'src/plugins/data/public'; +import type { DataView } from 'src/plugins/data_views/public'; import { createContextSearchSourceStub } from './_stubs'; import { DataPublicPluginStart, Query } from '../../../../../data/public'; import { fetchSurroundingDocs, SurrDocType } from './context'; diff --git a/src/plugins/discover/public/application/context/services/context.ts b/src/plugins/discover/public/application/context/services/context.ts index 5425c0448dca3..81e11c05e7280 100644 --- a/src/plugins/discover/public/application/context/services/context.ts +++ b/src/plugins/discover/public/application/context/services/context.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ import type { Filter } from '@kbn/es-query'; -import { DataView, ISearchSource } from 'src/plugins/data/common'; -import { DataPublicPluginStart } from 'src/plugins/data/public'; +import { DataView } from 'src/plugins/data_views/public'; +import { DataPublicPluginStart, ISearchSource } from 'src/plugins/data/public'; import { reverseSortDir, SortDirection } from '../utils/sorting'; import { convertIsoToMillis, extractNanos } from '../utils/date_conversion'; import { fetchHitsInInterval } from '../utils/fetch_hits_in_interval'; diff --git a/src/plugins/discover/public/application/context/utils/get_es_query_sort.ts b/src/plugins/discover/public/application/context/utils/get_es_query_sort.ts index 955ae983d2caa..5fcc831cce746 100644 --- a/src/plugins/discover/public/application/context/utils/get_es_query_sort.ts +++ b/src/plugins/discover/public/application/context/utils/get_es_query_sort.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { EsQuerySortValue, SortDirection } from 'src/plugins/data/common'; +import type { EsQuerySortValue, SortDirection } from 'src/plugins/data/public'; /** * Returns `EsQuerySort` which is used to sort records in the ES query diff --git a/src/plugins/discover/public/application/context/utils/sorting.ts b/src/plugins/discover/public/application/context/utils/sorting.ts index 9649e3e677b56..5b31176c74f95 100644 --- a/src/plugins/discover/public/application/context/utils/sorting.ts +++ b/src/plugins/discover/public/application/context/utils/sorting.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; export enum SortDirection { asc = 'asc', diff --git a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.tsx b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.tsx index b9eb4db79a992..d67ca4e4ca242 100644 --- a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.tsx +++ b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.test.tsx @@ -20,7 +20,7 @@ import { } from '../__mocks__/use_context_app_fetch'; import { indexPatternWithTimefieldMock } from '../../../__mocks__/index_pattern_with_timefield'; import { createContextSearchSourceStub } from '../services/_stubs'; -import { DataView } from '../../../../../data_views/common'; +import { DataView } from '../../../../../data_views/public'; import { themeServiceMock } from '../../../../../../core/public/mocks'; import { KibanaContextProvider } from '../../../../../kibana_react/public'; diff --git a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx index 2568a574df25d..aaed483ae8be6 100644 --- a/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx +++ b/src/plugins/discover/public/application/context/utils/use_context_app_fetch.tsx @@ -11,7 +11,8 @@ import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../common'; import { fetchAnchor } from '../services/anchor'; import { fetchSurroundingDocs, SurrDocType } from '../services/context'; import { MarkdownSimple, toMountPoint, wrapWithTheme } from '../../../../../kibana_react/public'; -import { DataView, SortDirection } from '../../../../../data/common'; +import type { DataView } from '../../../../../data_views/public'; +import { SortDirection } from '../../../../../data/public'; import { ContextFetchState, FailureReason, diff --git a/src/plugins/discover/public/application/doc/components/doc.tsx b/src/plugins/discover/public/application/doc/components/doc.tsx index e70f66de30244..590651e1e6335 100644 --- a/src/plugins/discover/public/application/doc/components/doc.tsx +++ b/src/plugins/discover/public/application/doc/components/doc.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiCallOut, EuiLink, EuiLoadingSpinner, EuiPageContent, EuiPage } from '@elastic/eui'; -import { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { DocViewer } from '../../../services/doc_views/components/doc_viewer'; import { ElasticRequestState } from '../types'; import { useEsDocSearch } from '../../../utils/use_es_doc_search'; diff --git a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx index f54c631689099..a7e5baa8592eb 100644 --- a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx +++ b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { Subject, BehaviorSubject } from 'rxjs'; import { mountWithIntl } from '@kbn/test-jest-helpers'; -import type { DataView } from '../../../../../../data/common'; +import type { DataView } from '../../../../../../data_views/public'; import { setHeaderActionMenuMounter, setUiActions } from '../../../../kibana_services'; import { esHits } from '../../../../__mocks__/es_hits'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; diff --git a/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx b/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx index 636770b6965b7..bd0f637f14c71 100644 --- a/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx +++ b/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx @@ -17,7 +17,7 @@ import { EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import type { DataView } from '../../../../../../data/common'; +import type { DataView } from '../../../../../../data_views/public'; import { HitsCounter } from '../hits_counter'; import { SavedSearch } from '../../../../services/saved_searches'; import { GetStateReturn } from '../../services/discover_state'; diff --git a/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx b/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx index f426aeed9cab8..63e41c44e2998 100644 --- a/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx +++ b/src/plugins/discover/public/application/main/components/field_stats_table/field_stats_table.tsx @@ -10,7 +10,8 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import type { Filter } from '@kbn/es-query'; import { METRIC_TYPE, UiCounterMetricType } from '@kbn/analytics'; import { useDiscoverServices } from '../../../../utils/use_discover_services'; -import { DataViewField, DataView, Query } from '../../../../../../data/common'; +import type { Query } from '../../../../../../data/public'; +import type { DataViewField, DataView } from '../../../../../../data_views/public'; import { EmbeddableInput, EmbeddableOutput, diff --git a/src/plugins/discover/public/application/main/components/layout/discover_documents.tsx b/src/plugins/discover/public/application/main/components/layout/discover_documents.tsx index 71033de462751..b3b1b31186dbd 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_documents.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_documents.tsx @@ -25,7 +25,7 @@ import { SEARCH_FIELDS_FROM_SOURCE, } from '../../../../../common'; import { useColumns } from '../../../../utils/use_data_grid_columns'; -import { DataView } from '../../../../../../data/common'; +import { DataView } from '../../../../../../data_views/public'; import { SavedSearch } from '../../../../services/saved_searches'; import { DataDocumentsMsg, DataDocuments$ } from '../../utils/use_saved_search'; import { AppState, GetStateReturn } from '../../services/discover_state'; diff --git a/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx b/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx index 7b0845cd199c0..c9a9ea6441a0b 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx @@ -15,7 +15,7 @@ import { esHits } from '../../../../__mocks__/es_hits'; import { indexPatternMock } from '../../../../__mocks__/index_pattern'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; import { createSearchSourceMock } from '../../../../../../data/common/search/search_source/mocks'; -import { DataView, IndexPatternAttributes } from '../../../../../../data/common'; +import type { DataView, DataViewAttributes } from '../../../../../../data_views/public'; import { SavedObject } from '../../../../../../../core/types'; import { indexPatternWithTimefieldMock } from '../../../../__mocks__/index_pattern_with_timefield'; import { GetStateReturn } from '../../services/discover_state'; @@ -57,7 +57,7 @@ function mountComponent(indexPattern: DataView, prevSidebarClosed?: boolean) { const indexPatternList = [indexPattern].map((ip) => { return { ...ip, ...{ attributes: { title: ip.title } } }; - }) as unknown as Array>; + }) as unknown as Array>; const main$ = new BehaviorSubject({ fetchStatus: FetchStatus.COMPLETE, diff --git a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx index 765ea8f6f904d..8be5e2b7ce4be 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx @@ -25,7 +25,7 @@ import { useDiscoverServices } from '../../../../utils/use_discover_services'; import { DiscoverNoResults } from '../no_results'; import { LoadingSpinner } from '../loading_spinner/loading_spinner'; import { generateFilters } from '../../../../../../data/public'; -import { DataViewField } from '../../../../../../data/common'; +import { DataViewField } from '../../../../../../data_views/public'; import { DiscoverSidebarResponsive } from '../sidebar'; import { DiscoverLayoutProps } from './types'; import { SEARCH_FIELDS_FROM_SOURCE, SHOW_FIELD_STATISTICS } from '../../../../../common'; @@ -48,7 +48,7 @@ import { import { FieldStatisticsTable } from '../field_stats_table'; import { VIEW_MODE } from '../../../../components/view_mode_toggle'; import { DOCUMENTS_VIEW_CLICK, FIELD_STATISTICS_VIEW_CLICK } from '../field_stats_table/constants'; -import { DataViewType, DataView } from '../../../../../../data_views/common'; +import { DataViewType, DataView } from '../../../../../../data_views/public'; /** * Local storage key for sidebar persistence state diff --git a/src/plugins/discover/public/application/main/components/layout/types.ts b/src/plugins/discover/public/application/main/components/layout/types.ts index 9096c5f418963..4399cacf8c3c6 100644 --- a/src/plugins/discover/public/application/main/components/layout/types.ts +++ b/src/plugins/discover/public/application/main/components/layout/types.ts @@ -6,13 +6,8 @@ * Side Public License, v 1. */ -import { - DataView, - IndexPatternAttributes, - Query, - SavedObject, - TimeRange, -} from '../../../../../../data/common'; +import type { Query, TimeRange, SavedObject } from '../../../../../../data/public'; +import type { DataView, DataViewAttributes } from '../../../../../../data_views/public'; import { ISearchSource } from '../../../../../../data/public'; import { AppState, GetStateReturn } from '../../services/discover_state'; import { DataRefetch$, SavedSearchData } from '../../utils/use_saved_search'; @@ -22,7 +17,7 @@ import { ElasticSearchHit } from '../../../../types'; export interface DiscoverLayoutProps { indexPattern: DataView; - indexPatternList: Array>; + indexPatternList: Array>; inspectorAdapters: { requests: RequestAdapter }; navigateTo: (url: string) => void; onChangeIndexPattern: (id: string) => void; diff --git a/src/plugins/discover/public/application/main/components/sidebar/__stories__/discover_field_details.stories.tsx b/src/plugins/discover/public/application/main/components/sidebar/__stories__/discover_field_details.stories.tsx index cecf02c016676..2951840b834b0 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/__stories__/discover_field_details.stories.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/__stories__/discover_field_details.stories.tsx @@ -10,7 +10,7 @@ import { storiesOf } from '@storybook/react'; import React from 'react'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; import { DiscoverFieldDetails } from '../discover_field_details'; -import { DataView, IndexPatternField } from '../../../../../../../data_views/common'; +import { DataView, IndexPatternField } from '../../../../../../../data_views/public'; import { fieldSpecMap } from './fields'; import { numericField as field } from './fields'; import { Bucket } from '../types'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/__stories__/fields.ts b/src/plugins/discover/public/application/main/components/sidebar/__stories__/fields.ts index 950ea5b328e6f..ce630953d9d3c 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/__stories__/fields.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/__stories__/fields.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FieldSpec, IndexPatternField } from '../../../../../../../data_views/common'; +import { DataViewField, FieldSpec } from '../../../../../../../data_views/public'; export const fieldSpecMap: Record = { 'machine.os': { @@ -39,7 +39,7 @@ export const fieldSpecMap: Record = { }, }; -export const numericField = new IndexPatternField({ +export const numericField = new DataViewField({ name: 'bytes', type: 'number', esTypes: ['long'], diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx index c2ba365ef5fda..9447405e878be 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx @@ -11,9 +11,9 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverField } from './discover_field'; -import { DataViewField } from '../../../../../../data/common'; -import { stubIndexPattern } from '../../../../../../data/common/stubs'; +import { DataViewField } from '../../../../../../data_views/public'; import { KibanaContextProvider } from '../../../../../../kibana_react/public'; +import { stubDataView } from '../../../../../../data_views/common/data_view.stub'; jest.mock('../../../../kibana_services', () => ({ getUiActions: jest.fn(() => { @@ -46,7 +46,7 @@ function getComponent({ }); const props = { - indexPattern: stubIndexPattern, + indexPattern: stubDataView, field: finalField, getDetails: jest.fn(() => ({ buckets: [], error: '', exists: 1, total: 2, columns: [] })), onAddFilter: jest.fn(), diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx index 54f42ad1e63fa..e629c85c6d242 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx @@ -27,7 +27,7 @@ import classNames from 'classnames'; import { FieldButton, FieldIcon } from '@kbn/react-field'; import { DiscoverFieldDetails } from './discover_field_details'; import { FieldDetails } from './types'; -import { DataViewField, DataView } from '../../../../../../data/common'; +import type { DataViewField, DataView } from '../../../../../../data_views/public'; import { getFieldTypeName } from './lib/get_field_type_name'; import { DiscoverFieldVisualize } from './discover_field_visualize'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_bucket.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_bucket.tsx index 7008764407ad9..86f563c546654 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_bucket.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_bucket.tsx @@ -11,7 +11,7 @@ import { EuiText, EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@e import { i18n } from '@kbn/i18n'; import { StringFieldProgressBar } from './string_progress_bar'; import { Bucket } from './types'; -import { DataViewField } from '../../../../../../data/common'; +import { DataViewField } from '../../../../../../data_views/public'; import './discover_field_bucket.scss'; interface Props { diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx index 77f2d0fd89d25..e7ae1043851be 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx @@ -11,13 +11,13 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverFieldDetails } from './discover_field_details'; -import { DataViewField } from '../../../../../../data/common'; -import { stubIndexPattern } from '../../../../../../data/common/stubs'; +import { DataViewField } from '../../../../../../data_views/public'; +import { stubDataView } from '../../../../../../data_views/common/data_view.stub'; describe('discover sidebar field details', function () { const onAddFilter = jest.fn(); const defaultProps = { - indexPattern: stubIndexPattern, + indexPattern: stubDataView, details: { buckets: [], error: '', exists: 1, total: 2, columns: [] }, onAddFilter, }; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.tsx index 166535bfba167..dfd01a9769abd 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.tsx @@ -11,7 +11,7 @@ import { EuiText, EuiSpacer, EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { DiscoverFieldBucket } from './discover_field_bucket'; import { Bucket, FieldDetails } from './types'; -import { DataViewField, DataView } from '../../../../../../data/common'; +import { DataViewField, DataView } from '../../../../../../data_views/public'; interface DiscoverFieldDetailsProps { field: DataViewField; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize.tsx index fb845828d62ab..1adb355b6ef40 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react'; import { METRIC_TYPE, UiCounterMetricType } from '@kbn/analytics'; -import type { DataView, DataViewField } from 'src/plugins/data/common'; +import type { DataView, DataViewField } from 'src/plugins/data_views/public'; import { triggerVisualizeActions, VisualizeInformation } from './lib/visualize_trigger_utils'; import type { FieldDetails } from './types'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize_inner.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize_inner.tsx index f4c7205f25026..d2b9e5cd6b587 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize_inner.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_visualize_inner.tsx @@ -9,11 +9,11 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { IndexPatternField } from '../../../../../../data_views/common'; +import type { DataViewField } from '../../../../../../data_views/public'; import { VisualizeInformation } from './lib/visualize_trigger_utils'; interface DiscoverFieldVisualizeInnerProps { - field: IndexPatternField; + field: DataViewField; visualizeInfo: VisualizeInformation; handleVisualizeLinkClick: (event: React.MouseEvent) => void; } diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx index 73f460cccf784..aa44976ab50fb 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx @@ -14,7 +14,7 @@ import { ChangeIndexPattern } from './change_indexpattern'; import { SavedObject } from 'kibana/server'; import { DiscoverIndexPattern, DiscoverIndexPatternProps } from './discover_index_pattern'; import { EuiSelectable } from '@elastic/eui'; -import { DataView, DataViewAttributes } from 'src/plugins/data/common'; +import type { DataView, DataViewAttributes } from 'src/plugins/data_views/public'; import { indexPatternsMock } from '../../../../__mocks__/index_patterns'; const indexPattern = { diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.tsx index 6965f3af374ca..0bbd78ed36cb7 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.tsx @@ -8,7 +8,7 @@ import React, { useState, useEffect } from 'react'; import { SavedObject } from 'kibana/public'; -import { DataView, DataViewAttributes } from 'src/plugins/data/common'; +import type { DataView, DataViewAttributes } from 'src/plugins/data_views/public'; import { IndexPatternRef } from './types'; import { ChangeIndexPattern } from './change_indexpattern'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.tsx index b62e6e15c55af..f993d151f4479 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.tsx @@ -16,7 +16,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useDiscoverServices } from '../../../../utils/use_discover_services'; -import { DataView } from '../../../../../../data/common'; +import type { DataView } from '../../../../../../data_views/public'; export interface DiscoverIndexPatternManagementProps { /** diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx index 8a9e9a0ee6872..266174a002271 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx @@ -15,7 +15,8 @@ import realHits from '../../../../__fixtures__/real_hits.js'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DiscoverSidebarProps } from './discover_sidebar'; -import { flattenHit, IndexPatternAttributes } from '../../../../../../data/common'; +import { flattenHit } from '../../../../../../data/public'; +import { DataViewAttributes } from '../../../../../../data_views/public'; import { SavedObject } from '../../../../../../../core/types'; import { getDefaultFieldFilter } from './lib/field_filter'; import { DiscoverSidebarComponent as DiscoverSidebar } from './discover_sidebar'; @@ -37,9 +38,9 @@ function getCompProps(): DiscoverSidebarProps { > as ElasticSearchHit[]; const indexPatternList = [ - { id: '0', attributes: { title: 'b' } } as SavedObject, - { id: '1', attributes: { title: 'a' } } as SavedObject, - { id: '2', attributes: { title: 'c' } } as SavedObject, + { id: '0', attributes: { title: 'b' } } as SavedObject, + { id: '1', attributes: { title: 'a' } } as SavedObject, + { id: '2', attributes: { title: 'c' } } as SavedObject, ]; const fieldCounts: Record = {}; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx index 6569348f99038..5b9f9a6c452d6 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx @@ -39,7 +39,7 @@ import { DiscoverSidebarResponsiveProps } from './discover_sidebar_responsive'; import { DiscoverIndexPatternManagement } from './discover_index_pattern_management'; import { VIEW_MODE } from '../../../../components/view_mode_toggle'; import { ElasticSearchHit } from '../../../../types'; -import { DataViewField } from '../../../../../../data_views/common'; +import { DataViewField } from '../../../../../../data_views/public'; /** * Default number of available fields displayed and added on scroll diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx index 7f1f6b94eab16..05e0e25d606f6 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx @@ -15,7 +15,8 @@ import realHits from '../../../../__fixtures__/real_hits.js'; import { act } from 'react-dom/test-utils'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; -import { flattenHit, IndexPatternAttributes } from '../../../../../../data/common'; +import { DataViewAttributes } from '../../../../../../data_views/public'; +import { flattenHit } from '../../../../../../data/public'; import { SavedObject } from '../../../../../../../core/types'; import { DiscoverSidebarResponsive, @@ -78,9 +79,9 @@ function getCompProps(): DiscoverSidebarResponsiveProps { > as ElasticSearchHit[]; const indexPatternList = [ - { id: '0', attributes: { title: 'b' } } as SavedObject, - { id: '1', attributes: { title: 'a' } } as SavedObject, - { id: '2', attributes: { title: 'c' } } as SavedObject, + { id: '0', attributes: { title: 'b' } } as SavedObject, + { id: '1', attributes: { title: 'a' } } as SavedObject, + { id: '2', attributes: { title: 'c' } } as SavedObject, ]; for (const hit of hits) { diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx index ce23e0a8e18f8..506c16de8ee02 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx @@ -28,7 +28,11 @@ import { } from '@elastic/eui'; import { useDiscoverServices } from '../../../../utils/use_discover_services'; import { DiscoverIndexPattern } from './discover_index_pattern'; -import { DataViewField, DataView, DataViewAttributes } from '../../../../../../data/common'; +import type { + DataViewField, + DataView, + DataViewAttributes, +} from '../../../../../../data_views/public'; import { SavedObject } from '../../../../../../../core/types'; import { getDefaultFieldFilter } from './lib/field_filter'; import { DiscoverSidebar } from './discover_sidebar'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.js b/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.js index 4f282f6133ef3..5562d0159a76d 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.js +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.js @@ -8,7 +8,7 @@ import { map, sortBy, without, each, defaults, isObject } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { flattenHit } from '../../../../../../../data/common'; +import { flattenHit } from '../../../../../../../data/public'; function getFieldValues(hits, field, indexPattern) { const name = field.name; diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.test.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.test.ts index 6e2d7b2785955..f94032afb18d6 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.test.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/field_calculator.test.ts @@ -11,11 +11,12 @@ import { keys, each, cloneDeep, clone, uniq, filter, map } from 'lodash'; // @ts-expect-error import realHits from '../../../../../__fixtures__/real_hits.js'; -import { flattenHit, DataView } from '../../../../../../../data/common'; +import { flattenHit } from '../../../../../../../data/public'; +import type { DataView } from '../../../../../../../data_views/public'; // @ts-expect-error import { fieldCalculator } from './field_calculator'; -import { stubLogstashIndexPattern as indexPattern } from '../../../../../../../data/common/stubs'; +import { stubLogstashDataView as dataView } from '../../../../../../../data_views/common/data_view.stub'; describe('fieldCalculator', function () { it('should have a _countMissing that counts nulls & undefineds in an array', function () { @@ -119,14 +120,14 @@ describe('fieldCalculator', function () { let hits: any; beforeEach(function () { - hits = each(cloneDeep(realHits), (hit) => flattenHit(hit, indexPattern)); + hits = each(cloneDeep(realHits), (hit) => flattenHit(hit, dataView)); }); it('Should return an array of values for _source fields', function () { const extensions = fieldCalculator.getFieldValues( hits, - indexPattern.fields.getByName('extension'), - indexPattern + dataView.fields.getByName('extension'), + dataView ); expect(extensions).toBeInstanceOf(Array); expect( @@ -140,8 +141,8 @@ describe('fieldCalculator', function () { it('Should return an array of values for core meta fields', function () { const types = fieldCalculator.getFieldValues( hits, - indexPattern.fields.getByName('_id'), - indexPattern + dataView.fields.getByName('_id'), + dataView ); expect(types).toBeInstanceOf(Array); expect(types.length).toBe(20); @@ -149,13 +150,13 @@ describe('fieldCalculator', function () { }); describe('getFieldValueCounts', function () { - let params: { hits: any; field: any; count: number; indexPattern: DataView }; + let params: { hits: any; field: any; count: number; dataView: DataView }; beforeEach(function () { params = { hits: cloneDeep(realHits), - field: indexPattern.fields.getByName('extension'), + field: dataView.fields.getByName('extension'), count: 3, - indexPattern, + dataView, }; }); @@ -169,18 +170,18 @@ describe('fieldCalculator', function () { }); it('fails to analyze geo and attachment types', function () { - params.field = indexPattern.fields.getByName('point'); + params.field = dataView.fields.getByName('point'); expect(fieldCalculator.getFieldValueCounts(params).error).not.toBe(undefined); - params.field = indexPattern.fields.getByName('area'); + params.field = dataView.fields.getByName('area'); expect(fieldCalculator.getFieldValueCounts(params).error).not.toBe(undefined); - params.field = indexPattern.fields.getByName('request_body'); + params.field = dataView.fields.getByName('request_body'); expect(fieldCalculator.getFieldValueCounts(params).error).not.toBe(undefined); }); it('fails to analyze fields that are in the mapping, but not the hits', function () { - params.field = indexPattern.fields.getByName('ip'); + params.field = dataView.fields.getByName('ip'); expect(fieldCalculator.getFieldValueCounts(params).error).not.toBe(undefined); }); @@ -189,7 +190,7 @@ describe('fieldCalculator', function () { }); it('counts the hits the field exists in', function () { - params.field = indexPattern.fields.getByName('phpmemory'); + params.field = dataView.fields.getByName('phpmemory'); expect(fieldCalculator.getFieldValueCounts(params).exists).toBe(5); }); }); diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.test.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.test.ts index 64468b2d446c8..c298c198dd267 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.test.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.test.ts @@ -7,7 +7,7 @@ */ import { getDefaultFieldFilter, setFieldFilterProp, isFieldFiltered } from './field_filter'; -import { DataViewField } from '../../../../../../../data/common'; +import { DataViewField } from '../../../../../../../data_views/public'; describe('field_filter', function () { it('getDefaultFieldFilter should return default filter state', function () { diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.ts index 8bbaf7e4137b3..602c25c2c99c9 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/field_filter.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DataViewField } from '../../../../../../../data/common'; +import { DataViewField } from '../../../../../../../data_views/public'; export interface FieldFilterState { missing: boolean; diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/get_details.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/get_details.ts index 29b0a16e7fa12..6111b2bf0876d 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/get_details.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/get_details.ts @@ -8,7 +8,7 @@ // @ts-expect-error import { fieldCalculator } from './field_calculator'; -import { DataView, DataViewField } from '../../../../../../../data/common'; +import { DataView, DataViewField } from '../../../../../../../data_views/public'; import { ElasticSearchHit } from '../../../../../types'; export function getDetails( diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/get_index_pattern_field_list.ts index 08007b81b1a81..c53e3b494f2cb 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/get_index_pattern_field_list.ts @@ -7,7 +7,7 @@ */ import { difference } from 'lodash'; -import { DataView, DataViewField } from 'src/plugins/data/common'; +import { DataView, DataViewField } from 'src/plugins/data_views/public'; import { isNestedFieldParent } from '../../../utils/nested_fields'; export function getIndexPatternFieldList( diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.test.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.test.ts index ff7232f8c0a8c..afd5eb6964598 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.test.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.test.ts @@ -8,7 +8,7 @@ import { groupFields } from './group_fields'; import { getDefaultFieldFilter } from './field_filter'; -import { DataViewField } from '../../../../../../../data/common'; +import { DataViewField } from '../../../../../../../data_views/public'; const fields = [ { diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.tsx b/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.tsx index 41fd49bf92ec5..8d2a7db8e30a5 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/group_fields.tsx @@ -7,7 +7,7 @@ */ import { FieldFilterState, isFieldFiltered } from './field_filter'; -import { getFieldSubtypeMulti, DataViewField } from '../../../../../../../data/common'; +import { DataViewField, getFieldSubtypeMulti } from '../../../../../../../data_views/public'; interface GroupedFields { selected: DataViewField[]; diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.test.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.test.ts index b0923cd6dd0e7..5494f5bfee590 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.test.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { DataViewField } from 'src/plugins/data/common'; +import type { DataViewField } from 'src/plugins/data_views/public'; import type { Action } from 'src/plugins/ui_actions/public'; import { getVisualizeInformation } from './visualize_trigger_utils'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts index 275b919d5e058..50ca2cae1bcc7 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts @@ -13,7 +13,8 @@ import { visualizeGeoFieldTrigger, } from '../../../../../../../ui_actions/public'; import { getUiActions } from '../../../../../kibana_services'; -import { DataViewField, KBN_FIELD_TYPES } from '../../../../../../../data/common'; +import type { DataViewField } from '../../../../../../../data_views/public'; +import { KBN_FIELD_TYPES } from '../../../../../../../data/public'; import { APP_ID } from '../../../../../../common'; function getTriggerConstant(type: string) { diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx index 2c5c5ffb37d69..834e7283bddfb 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx @@ -12,7 +12,7 @@ import { indexPatternMock } from '../../../../__mocks__/index_pattern'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; import { DiscoverTopNav, DiscoverTopNavProps } from './discover_topnav'; import { TopNavMenuData } from '../../../../../../navigation/public'; -import { ISearchSource, Query } from '../../../../../../data/common'; +import { ISearchSource, Query } from '../../../../../../data/public'; import { GetStateReturn } from '../../services/discover_state'; import { setHeaderActionMenuMounter } from '../../../../kibana_services'; import { discoverServiceMock } from '../../../../__mocks__/services'; diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx index 63e75c74af795..d0b79cf11a519 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx @@ -10,10 +10,10 @@ import { useHistory } from 'react-router-dom'; import { useDiscoverServices } from '../../../../utils/use_discover_services'; import { DiscoverLayoutProps } from '../layout/types'; import { getTopNavLinks } from './get_top_nav_links'; -import { Query, TimeRange } from '../../../../../../data/common/query'; +import { Query, TimeRange } from '../../../../../../data/public'; import { getHeaderActionMenuMounter } from '../../../../kibana_services'; import { GetStateReturn } from '../../services/discover_state'; -import { DataViewType } from '../../../../../../data_views/common'; +import { DataViewType } from '../../../../../../data_views/public'; export type DiscoverTopNavProps = Pick< DiscoverLayoutProps, diff --git a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts index 0a8bcae983d35..a5627cc1d19d9 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts +++ b/src/plugins/discover/public/application/main/components/top_nav/get_top_nav_links.ts @@ -7,7 +7,8 @@ */ import { i18n } from '@kbn/i18n'; -import type { DataView, ISearchSource } from 'src/plugins/data/common'; +import type { ISearchSource } from 'src/plugins/data/public'; +import type { DataView } from 'src/plugins/data_views/public'; import { showOpenSearchPanel } from './show_open_search_panel'; import { getSharingData, showPublicUrlSwitch } from '../../../../utils/get_sharing_data'; import { unhashUrl } from '../../../../../../kibana_utils/public'; 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 2bcb0b57e01f0..c56a7f8f347da 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 @@ -10,7 +10,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { SavedObjectSaveModal, showSaveModal } from '../../../../../../saved_objects/public'; import { SavedSearch, SaveSavedSearchOptions } from '../../../../services/saved_searches'; -import { DataView } from '../../../../../../data/common'; +import { DataView } from '../../../../../../data_views/public'; import { DiscoverServices } from '../../../../build_services'; import { GetStateReturn } from '../../services/discover_state'; import { setBreadcrumbsTitle } from '../../../../utils/breadcrumbs'; diff --git a/src/plugins/discover/public/application/main/discover_main_app.test.tsx b/src/plugins/discover/public/application/main/discover_main_app.test.tsx index 5d3b28bb35c5f..86cd009b86d77 100644 --- a/src/plugins/discover/public/application/main/discover_main_app.test.tsx +++ b/src/plugins/discover/public/application/main/discover_main_app.test.tsx @@ -11,7 +11,7 @@ import { indexPatternMock } from '../../__mocks__/index_pattern'; import { DiscoverMainApp } from './discover_main_app'; import { savedSearchMock } from '../../__mocks__/saved_search'; import { SavedObject } from '../../../../../core/types'; -import { IndexPatternAttributes } from '../../../../data/common'; +import type { DataViewAttributes } from '../../../../data_views/public'; import { setHeaderActionMenuMounter } from '../../kibana_services'; import { findTestSubject } from '@elastic/eui/lib/test'; import { KibanaContextProvider } from '../../../../kibana_react/public'; @@ -25,7 +25,7 @@ describe('DiscoverMainApp', () => { test('renders', () => { const indexPatternList = [indexPatternMock].map((ip) => { return { ...ip, ...{ attributes: { title: ip.title } } }; - }) as unknown as Array>; + }) as unknown as Array>; const props = { indexPatternList, savedSearch: savedSearchMock, diff --git a/src/plugins/discover/public/application/main/discover_main_app.tsx b/src/plugins/discover/public/application/main/discover_main_app.tsx index 846a1fe33c826..74bd997df0a42 100644 --- a/src/plugins/discover/public/application/main/discover_main_app.tsx +++ b/src/plugins/discover/public/application/main/discover_main_app.tsx @@ -12,7 +12,8 @@ import { setBreadcrumbsTitle } from '../../utils/breadcrumbs'; import { addHelpMenuToAppChrome } from '../../components/help_menu/help_menu_util'; import { useDiscoverState } from './utils/use_discover_state'; import { useUrl } from './utils/use_url'; -import { IndexPatternAttributes, SavedObject } from '../../../../data/common'; +import type { DataViewAttributes } from '../../../../data_views/public'; +import type { SavedObject } from '../../../../data/public'; import { SavedSearch } from '../../services/saved_searches'; import { ElasticSearchHit } from '../../types'; import { useDiscoverServices } from '../../utils/use_discover_services'; @@ -23,7 +24,7 @@ export interface DiscoverMainProps { /** * List of available index patterns */ - indexPatternList: Array>; + indexPatternList: Array>; /** * Current instance of SavedSearch */ diff --git a/src/plugins/discover/public/application/main/discover_main_route.tsx b/src/plugins/discover/public/application/main/discover_main_route.tsx index dcf229d36b1e0..84d702dab7627 100644 --- a/src/plugins/discover/public/application/main/discover_main_route.tsx +++ b/src/plugins/discover/public/application/main/discover_main_route.tsx @@ -7,8 +7,12 @@ */ import React, { useEffect, useState, memo, useCallback } from 'react'; import { useParams, useHistory } from 'react-router-dom'; - -import { IndexPatternAttributes, ISearchSource, SavedObject } from 'src/plugins/data/common'; +import { SavedObject } from 'src/plugins/data/public'; +import { ISearchSource } from 'src/plugins/data/public'; +import { + DataViewAttributes, + DataViewSavedObjectConflictError, +} from '../../../../data_views/public'; import { SavedSearch, getSavedSearch, @@ -19,7 +23,6 @@ import { loadIndexPattern, resolveIndexPattern } from './utils/resolve_index_pat import { DiscoverMainApp } from './discover_main_app'; import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../../utils/breadcrumbs'; import { redirectWhenMissing } from '../../../../kibana_utils/public'; -import { DataViewSavedObjectConflictError } from '../../../../data_views/common'; import { LoadingIndicator } from '../../components/common/loading_indicator'; import { DiscoverError } from '../../components/common/error_alert'; import { useDiscoverServices } from '../../utils/use_discover_services'; @@ -46,9 +49,9 @@ export function DiscoverMainRoute() { const [error, setError] = useState(); const [savedSearch, setSavedSearch] = useState(); const indexPattern = savedSearch?.searchSource?.getField('index'); - const [indexPatternList, setIndexPatternList] = useState< - Array> - >([]); + const [indexPatternList, setIndexPatternList] = useState>>( + [] + ); const { id } = useParams(); useExecutionContext(core.executionContext, { @@ -80,9 +83,9 @@ export function DiscoverMainRoute() { await checkForDataViews(); const { appStateContainer } = getState({ history, uiSettings: config }); const { index } = appStateContainer.getState(); - const ip = await loadIndexPattern(index || '', data.indexPatterns, config); + const ip = await loadIndexPattern(index || '', data.dataViews, config); - const ipList = ip.list as Array>; + const ipList = ip.list as Array>; const indexPatternData = await resolveIndexPattern(ip, searchSource, toastNotifications); setIndexPatternList(ipList); @@ -154,7 +157,7 @@ export function DiscoverMainRoute() { chrome.recentlyAccessed, config, core.application.navigateToApp, - data.indexPatterns, + data.dataViews, history, id, 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 4a3592f848de7..d3ef2aeff393f 100644 --- a/src/plugins/discover/public/application/main/services/discover_state.ts +++ b/src/plugins/discover/public/application/main/services/discover_state.ts @@ -28,7 +28,7 @@ import { SearchSessionInfoProvider, syncQueryStateWithUrl, } from '../../../../../data/public'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; import { migrateLegacyQuery } from '../../../utils/migrate_legacy_query'; import { DiscoverGridSettings } from '../../../components/discover_grid/types'; import { SavedSearch } from '../../../services/saved_searches'; diff --git a/src/plugins/discover/public/application/main/utils/calc_field_counts.ts b/src/plugins/discover/public/application/main/utils/calc_field_counts.ts index d7b82f6cb0f85..646ac7a10bf0b 100644 --- a/src/plugins/discover/public/application/main/utils/calc_field_counts.ts +++ b/src/plugins/discover/public/application/main/utils/calc_field_counts.ts @@ -5,8 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - -import { flattenHit, DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; +import { flattenHit } from '../../../../../data/public'; import { ElasticSearchHit } from '../../../types'; /** diff --git a/src/plugins/discover/public/application/main/utils/fetch_all.test.ts b/src/plugins/discover/public/application/main/utils/fetch_all.test.ts index 8ac965838c166..d63b2323f607e 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_all.test.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_all.test.ts @@ -8,7 +8,7 @@ import { FetchStatus } from '../../types'; import { BehaviorSubject, Subject } from 'rxjs'; import { reduce } from 'rxjs/operators'; -import { SearchSource } from '../../../../../data/common'; +import { SearchSource } from '../../../../../data/public'; import { RequestAdapter } from '../../../../../inspector'; import { savedSearchMock } from '../../../__mocks__/saved_search'; import { ReduxLikeStateContainer } from '../../../../../kibana_utils/common'; diff --git a/src/plugins/discover/public/application/main/utils/fetch_all.ts b/src/plugins/discover/public/application/main/utils/fetch_all.ts index 4109cbb73788f..da89b88e990a6 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_all.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_all.ts @@ -18,7 +18,7 @@ import type { SavedSearch, SortOrder } from '../../../services/saved_searches'; import { fetchDocuments } from './fetch_documents'; import { fetchTotalHits } from './fetch_total_hits'; import { fetchChart } from './fetch_chart'; -import { ISearchSource } from '../../../../../data/common'; +import { ISearchSource } from '../../../../../data/public'; import { Adapters } from '../../../../../inspector'; import { AppState } from '../services/discover_state'; import { FetchStatus } from '../../types'; @@ -32,7 +32,7 @@ import { } from './use_saved_search'; import { DiscoverServices } from '../../../build_services'; import { ReduxLikeStateContainer } from '../../../../../kibana_utils/common'; -import { DataViewType } from '../../../../../data_views/common'; +import { DataViewType } from '../../../../../data_views/public'; export interface FetchDeps { abortController: AbortController; diff --git a/src/plugins/discover/public/application/main/utils/fetch_chart.test.ts b/src/plugins/discover/public/application/main/utils/fetch_chart.test.ts index b1f736fa4b224..ec01c8069f8f3 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_chart.test.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_chart.test.ts @@ -12,7 +12,7 @@ import { fetchChart, updateSearchSource } from './fetch_chart'; import { ReduxLikeStateContainer } from '../../../../../kibana_utils/common'; import { AppState } from '../services/discover_state'; import { discoverServiceMock } from '../../../__mocks__/services'; -import { calculateBounds, IKibanaSearchResponse } from '../../../../../data/common'; +import { calculateBounds, IKibanaSearchResponse } from '../../../../../data/public'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { FetchDeps } from './fetch_all'; diff --git a/src/plugins/discover/public/application/main/utils/fetch_chart.ts b/src/plugins/discover/public/application/main/utils/fetch_chart.ts index 1ea2594a89d97..9d1baf6e57cb2 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_chart.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_chart.ts @@ -12,9 +12,9 @@ import { isCompleteResponse, search, ISearchSource, + tabifyAggResponse, } from '../../../../../data/public'; import { getChartAggConfigs, getDimensions } from './index'; -import { tabifyAggResponse } from '../../../../../data/common'; import { buildPointSeriesData, Chart } from '../components/chart/point_series'; import { TimechartBucketInterval } from './use_saved_search'; import { FetchDeps } from './fetch_all'; diff --git a/src/plugins/discover/public/application/main/utils/fetch_documents.test.ts b/src/plugins/discover/public/application/main/utils/fetch_documents.test.ts index 1e73f5de3a3f6..bca83de0c46dd 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_documents.test.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_documents.test.ts @@ -10,7 +10,7 @@ import { throwError as throwErrorRx, of } from 'rxjs'; import { RequestAdapter } from '../../../../../inspector'; import { savedSearchMock, savedSearchMockWithTimeField } from '../../../__mocks__/saved_search'; import { discoverServiceMock } from '../../../__mocks__/services'; -import { IKibanaSearchResponse } from 'src/plugins/data/common'; +import { IKibanaSearchResponse } from 'src/plugins/data/public'; import { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; import { FetchDeps } from './fetch_all'; import { fetchTotalHits } from './fetch_total_hits'; diff --git a/src/plugins/discover/public/application/main/utils/fetch_documents.ts b/src/plugins/discover/public/application/main/utils/fetch_documents.ts index 8338839e8b0ac..57be8911d7d0e 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_documents.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_documents.ts @@ -7,7 +7,7 @@ */ import { i18n } from '@kbn/i18n'; import { filter, map } from 'rxjs/operators'; -import { isCompleteResponse, ISearchSource } from '../../../../../data/common'; +import { isCompleteResponse, ISearchSource } from '../../../../../data/public'; import { SAMPLE_SIZE_SETTING } from '../../../../common'; import { FetchDeps } from './fetch_all'; diff --git a/src/plugins/discover/public/application/main/utils/fetch_total_hits.test.ts b/src/plugins/discover/public/application/main/utils/fetch_total_hits.test.ts index a5485c1a2e2e9..65848d7ddd254 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_total_hits.test.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_total_hits.test.ts @@ -11,7 +11,7 @@ import { savedSearchMock, savedSearchMockWithTimeField } from '../../../__mocks_ import { fetchTotalHits } from './fetch_total_hits'; import { discoverServiceMock } from '../../../__mocks__/services'; import { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; -import { IKibanaSearchResponse } from 'src/plugins/data/common'; +import { IKibanaSearchResponse } from 'src/plugins/data/public'; import { FetchDeps } from './fetch_all'; const getDeps = () => diff --git a/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts b/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts index e696570f05cf0..080cec6cf2646 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { filter, map } from 'rxjs/operators'; import { isCompleteResponse, ISearchSource } from '../../../../../data/public'; -import { DataViewType } from '../../../../../data_views/common'; +import { DataViewType } from '../../../../../data_views/public'; import { FetchDeps } from './fetch_all'; export function fetchTotalHits( diff --git a/src/plugins/discover/public/application/main/utils/get_chart_agg_configs.ts b/src/plugins/discover/public/application/main/utils/get_chart_agg_configs.ts index e33fe48302a04..c7210a49fbc32 100644 --- a/src/plugins/discover/public/application/main/utils/get_chart_agg_configs.ts +++ b/src/plugins/discover/public/application/main/utils/get_chart_agg_configs.ts @@ -5,8 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { ISearchSource } from '../../../../../data/common'; -import { DataPublicPluginStart } from '../../../../../data/public'; +import { DataPublicPluginStart, ISearchSource } from '../../../../../data/public'; /** * Helper function to apply or remove aggregations to a given search source used for gaining data diff --git a/src/plugins/discover/public/application/main/utils/get_dimensions.test.ts b/src/plugins/discover/public/application/main/utils/get_dimensions.test.ts index 56822a614ece7..1da3a5188ffc9 100644 --- a/src/plugins/discover/public/application/main/utils/get_dimensions.test.ts +++ b/src/plugins/discover/public/application/main/utils/get_dimensions.test.ts @@ -9,7 +9,7 @@ import { dataPluginMock } from '../../../../../data/public/mocks'; import { getDimensions } from './get_dimensions'; import { indexPatternWithTimefieldMock } from '../../../__mocks__/index_pattern_with_timefield'; -import { ISearchSource, calculateBounds } from '../../../../../data/common'; +import { ISearchSource, calculateBounds } from '../../../../../data/public'; import { getChartAggConfigs } from './get_chart_agg_configs'; test('getDimensions', () => { diff --git a/src/plugins/discover/public/application/main/utils/get_dimensions.ts b/src/plugins/discover/public/application/main/utils/get_dimensions.ts index 6fb9cd7865c4f..1c8bc70bb17e2 100644 --- a/src/plugins/discover/public/application/main/utils/get_dimensions.ts +++ b/src/plugins/discover/public/application/main/utils/get_dimensions.ts @@ -7,8 +7,7 @@ */ import moment from 'moment'; import dateMath from '@elastic/datemath'; -import { IAggConfigs } from '../../../../../data/common'; -import { DataPublicPluginStart, search } from '../../../../../data/public'; +import { DataPublicPluginStart, search, IAggConfigs } from '../../../../../data/public'; import { Dimensions, HistogramParamsBounds } from '../components/chart/point_series'; export function getDimensions( diff --git a/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.test.ts b/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.test.ts index 6bee6af4a172a..aeb51ad0606e5 100644 --- a/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.test.ts +++ b/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.test.ts @@ -7,7 +7,7 @@ */ import { getSwitchIndexPatternAppState } from './get_switch_index_pattern_app_state'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; /** * Helper function returning an index pattern diff --git a/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.ts b/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.ts index dd81bc2363325..b047c2743809b 100644 --- a/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.ts +++ b/src/plugins/discover/public/application/main/utils/get_switch_index_pattern_app_state.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { getSortArray, SortPairArr } from '../../../components/doc_table/lib/get_sort'; /** diff --git a/src/plugins/discover/public/application/main/utils/nested_fields.ts b/src/plugins/discover/public/application/main/utils/nested_fields.ts index b0cf1dae23ce9..2690c815717aa 100644 --- a/src/plugins/discover/public/application/main/utils/nested_fields.ts +++ b/src/plugins/discover/public/application/main/utils/nested_fields.ts @@ -7,7 +7,8 @@ */ import { escapeRegExp } from 'lodash/fp'; -import { getFieldSubtypeNested, DataView } from '../../../../../data/common'; +import { getFieldSubtypeNested } from '../../../../../data_views/public'; +import type { DataView } from '../../../../../data_views/public'; /** * This function checks if the given field in a given index pattern is a nested field's parent. diff --git a/src/plugins/discover/public/application/main/utils/persist_saved_search.ts b/src/plugins/discover/public/application/main/utils/persist_saved_search.ts index 60a9b0b7d5fcd..c73cf982d484d 100644 --- a/src/plugins/discover/public/application/main/utils/persist_saved_search.ts +++ b/src/plugins/discover/public/application/main/utils/persist_saved_search.ts @@ -7,7 +7,7 @@ */ import { updateSearchSource } from './update_search_source'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; import { SavedSearch } from '../../../services/saved_searches'; import { AppState } from '../services/discover_state'; import type { SortOrder } from '../../../services/saved_searches'; diff --git a/src/plugins/discover/public/application/main/utils/resolve_index_pattern.ts b/src/plugins/discover/public/application/main/utils/resolve_index_pattern.ts index fdcfce7cf1168..54a26a77e76c6 100644 --- a/src/plugins/discover/public/application/main/utils/resolve_index_pattern.ts +++ b/src/plugins/discover/public/application/main/utils/resolve_index_pattern.ts @@ -7,7 +7,8 @@ */ import { i18n } from '@kbn/i18n'; -import type { DataView, DataViewsContract, ISearchSource } from 'src/plugins/data/common'; +import type { DataView, DataViewsContract } from 'src/plugins/data_views/public'; +import type { ISearchSource } from 'src/plugins/data/public'; import type { IUiSettingsClient, SavedObject, ToastsStart } from 'kibana/public'; export type IndexPatternSavedObject = SavedObject & { title: string }; diff --git a/src/plugins/discover/public/application/main/utils/update_search_source.ts b/src/plugins/discover/public/application/main/utils/update_search_source.ts index a4107cee4c658..a94023f04e054 100644 --- a/src/plugins/discover/public/application/main/utils/update_search_source.ts +++ b/src/plugins/discover/public/application/main/utils/update_search_source.ts @@ -7,8 +7,8 @@ */ import { SORT_DEFAULT_ORDER_SETTING } from '../../../../common'; -import { DataView, ISearchSource } from '../../../../../data/common'; -import { DataViewType } from '../../../../../data_views/common'; +import { ISearchSource } from '../../../../../data/public'; +import { DataViewType, DataView } from '../../../../../data_views/public'; import type { SortOrder } from '../../../services/saved_searches'; import { DiscoverServices } from '../../../build_services'; import { getSortForSearchSource } from '../../../components/doc_table'; diff --git a/src/plugins/discover/public/application/main/utils/use_discover_state.test.ts b/src/plugins/discover/public/application/main/utils/use_discover_state.test.ts index e77ea5787705f..0c85885899232 100644 --- a/src/plugins/discover/public/application/main/utils/use_discover_state.test.ts +++ b/src/plugins/discover/public/application/main/utils/use_discover_state.test.ts @@ -12,7 +12,7 @@ import { discoverServiceMock } from '../../../__mocks__/services'; import { savedSearchMock } from '../../../__mocks__/saved_search'; import { useDiscoverState } from './use_discover_state'; import { indexPatternMock } from '../../../__mocks__/index_pattern'; -import { SearchSource } from '../../../../../data/common'; +import { SearchSource } from '../../../../../data/public'; describe('test useDiscoverState', () => { const originalSavedObjectsClient = discoverServiceMock.core.savedObjects.client; diff --git a/src/plugins/discover/public/application/main/utils/use_saved_search.ts b/src/plugins/discover/public/application/main/utils/use_saved_search.ts index ee44ac13e90b2..c8a59d2eb3167 100644 --- a/src/plugins/discover/public/application/main/utils/use_saved_search.ts +++ b/src/plugins/discover/public/application/main/utils/use_saved_search.ts @@ -9,7 +9,7 @@ import { useCallback, useEffect, useMemo, useRef } from 'react'; import { BehaviorSubject, Subject } from 'rxjs'; import { DiscoverServices } from '../../../build_services'; import { DiscoverSearchSessionManager } from '../services/discover_search_session'; -import { ISearchSource } from '../../../../../data/common'; +import { ISearchSource } from '../../../../../data/public'; import { GetStateReturn } from '../services/discover_state'; import { RequestAdapter } from '../../../../../inspector/public'; import type { AutoRefreshDoneFn } from '../../../../../data/public'; diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index f6492db6e8a42..f3c697d400a93 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -95,7 +95,7 @@ export const buildServices = memoize(function ( fieldFormats: plugins.fieldFormats, filterManager: plugins.data.query.filterManager, history: getHistory, - indexPatterns: plugins.data.indexPatterns, + indexPatterns: plugins.data.dataViews, inspector: plugins.inspector, metadata: { branch: context.env.packageInfo.branch, diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid.tsx index 34673310f2c6e..1074897e6a118 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid.tsx @@ -20,7 +20,8 @@ import { EuiLoadingSpinner, EuiIcon, } from '@elastic/eui'; -import { flattenHit, DataView } from '../../../../data/common'; +import type { DataView } from '../../../../data_views/public'; +import { flattenHit } from '../../../../data/public'; import { DocViewFilterFn } from '../../services/doc_views/doc_views_types'; import { getSchemaDetectors } from './discover_grid_schema'; import { DiscoverGridFlyout } from './discover_grid_flyout'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx index 80fc27b50b40a..0c6783fabf189 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx @@ -15,7 +15,7 @@ import { DiscoverGridContext } from './discover_grid_context'; import { indexPatternMock } from '../../__mocks__/index_pattern'; import { esHits } from '../../__mocks__/es_hits'; import { EuiButton } from '@elastic/eui'; -import { DataViewField } from 'src/plugins/data/common'; +import { DataViewField } from 'src/plugins/data_views/public'; describe('Discover cell actions ', function () { it('should not show cell actions for unfilterable fields', async () => { diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.tsx index 2444f4c901ccd..dac15af537563 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.tsx @@ -9,7 +9,8 @@ import React, { useContext } from 'react'; import { EuiDataGridColumnCellActionProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { flattenHit, DataViewField } from '../../../../data/common'; +import { DataViewField } from '../../../../data_views/public'; +import { flattenHit } from '../../../../data/public'; import { DiscoverGridContext } from './discover_grid_context'; export const FilterInBtn = ({ diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_columns.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_columns.tsx index 2aee9ae2229c7..23ccba6638ebb 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_columns.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_columns.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { EuiDataGridColumn, EuiIconTip, EuiScreenReaderOnly } from '@elastic/eui'; import { ExpandButton } from './discover_grid_expand_button'; import { DiscoverGridSettings } from './types'; -import type { DataView } from '../../../../data/common'; +import type { DataView } from '../../../../data_views/public'; import { buildCellActions } from './discover_grid_cell_actions'; import { getSchemaByKbnType } from './discover_grid_schema'; import { SelectButton } from './discover_grid_document_selection'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_context.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_context.tsx index 0aeb3e40745d2..33977d24b88a1 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_context.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_context.tsx @@ -7,9 +7,9 @@ */ import React from 'react'; -import type { DataView } from 'src/plugins/data/common'; -import { DocViewFilterFn } from '../../services/doc_views/doc_views_types'; -import { ElasticSearchHit } from '../../types'; +import type { DataView } from 'src/plugins/data_views/public'; +import type { DocViewFilterFn } from '../../services/doc_views/doc_views_types'; +import type { ElasticSearchHit } from '../../types'; export interface GridContext { expanded?: ElasticSearchHit; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx index cc10da2dfc464..cfda4b6579054 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx @@ -18,8 +18,8 @@ import { DocViewsRegistry } from '../../services/doc_views/doc_views_registry'; import { setDocViewsRegistry } from '../../kibana_services'; import { indexPatternWithTimefieldMock } from '../../__mocks__/index_pattern_with_timefield'; import { KibanaContextProvider } from '../../../../kibana_react/public'; -import { IndexPattern } from '../../../../data/common'; -import { ElasticSearchHit } from '../../types'; +import type { DataView } from '../../../../data_views/public'; +import type { ElasticSearchHit } from '../../types'; describe('Discover flyout', function () { setDocViewsRegistry(new DocViewsRegistry()); @@ -29,7 +29,7 @@ describe('Discover flyout', function () { hits, hitIndex, }: { - indexPattern?: IndexPattern; + indexPattern?: DataView; hits?: ElasticSearchHit[]; hitIndex?: number; }) => { diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.tsx index bdf9268c73060..1b2e0de906763 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.tsx @@ -8,7 +8,7 @@ import React, { useMemo, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { EuiFlexGroup, EuiFlexItem, diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_schema.ts b/src/plugins/discover/public/components/discover_grid/discover_grid_schema.ts index 5cf257fb16f2c..0cd90cebf226f 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_schema.ts +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_schema.ts @@ -7,7 +7,7 @@ */ import { kibanaJSON } from './constants'; -import { KBN_FIELD_TYPES } from '../../../../data/common'; +import { KBN_FIELD_TYPES } from '../../../../data/public'; export function getSchemaByKbnType(kbnType: string | undefined) { // Default DataGrid schemas: boolean, numeric, datetime, json, currency, string diff --git a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx index 0a4cf74c20a5f..901aeb71737ee 100644 --- a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { getRenderCellValueFn } from './get_render_cell_value'; import { indexPatternMock } from '../../__mocks__/index_pattern'; -import { flattenHit } from 'src/plugins/data/common'; +import { flattenHit } from 'src/plugins/data/public'; import { ElasticSearchHit } from '../../types'; jest.mock('../../utils/use_discover_services', () => { diff --git a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.tsx b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.tsx index fe2607415ace1..fe69ecc91d34b 100644 --- a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.tsx +++ b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.tsx @@ -8,8 +8,7 @@ import React, { Fragment, useContext, useEffect, useMemo } from 'react'; import { euiLightVars as themeLight, euiDarkVars as themeDark } from '@kbn/ui-theme'; - -import type { DataView, DataViewField } from 'src/plugins/data/common'; +import type { DataView, DataViewField } from 'src/plugins/data_views/public'; import { EuiDataGridCellValueElementProps, EuiDescriptionList, diff --git a/src/plugins/discover/public/components/doc_table/actions/columns.ts b/src/plugins/discover/public/components/doc_table/actions/columns.ts index f522d27eb62a0..ec3d2b42560f9 100644 --- a/src/plugins/discover/public/components/doc_table/actions/columns.ts +++ b/src/plugins/discover/public/components/doc_table/actions/columns.ts @@ -16,7 +16,7 @@ import { GetStateReturn as ContextGetStateReturn, } from '../../../application/context/services/context_state'; import { DataViewsContract } from '../../../../../data/public'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; import { popularizeField } from '../../../utils/popularize_field'; /** diff --git a/src/plugins/discover/public/components/doc_table/components/table_header/helpers.tsx b/src/plugins/discover/public/components/doc_table/components/table_header/helpers.tsx index 74798493cfe0f..56d9a3689a911 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_header/helpers.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_header/helpers.tsx @@ -7,7 +7,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; export type SortOrder = [string, string]; export interface ColumnProps { diff --git a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx index d29bd02e92d35..b1f5f69b6d096 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test-jest-helpers'; -import type { DataView, DataViewField } from 'src/plugins/data/common'; +import type { DataView, DataViewField } from 'src/plugins/data_views/public'; import { TableHeader } from './table_header'; import { findTestSubject } from '@elastic/eui/lib/test'; import { SortOrder } from './helpers'; diff --git a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.tsx b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.tsx index ffc0517ed5dd7..9dd044ed1d2ae 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.tsx @@ -7,7 +7,7 @@ */ import React, { useMemo } from 'react'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { TableHeaderColumn } from './table_header_column'; import { SortOrder, getDisplayedColumns } from './helpers'; import { getDefaultSort } from '../../lib/get_default_sort'; diff --git a/src/plugins/discover/public/components/doc_table/components/table_row.tsx b/src/plugins/discover/public/components/doc_table/components/table_row.tsx index 31b1c8f4913d2..b14db847e3ed8 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_row.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_row.tsx @@ -11,8 +11,9 @@ import classNames from 'classnames'; import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty, EuiIcon } from '@elastic/eui'; import { formatFieldValue } from '../../../utils/format_value'; -import { flattenHit, DataView } from '../../../../../data/common'; -import { DocViewer } from '../../../services/doc_views/components/doc_viewer/doc_viewer'; +import { flattenHit } from '../../../../../data/public'; +import { DataView } from '../../../../../data_views/public'; +import { DocViewer } from '../../../services/doc_views/components/doc_viewer'; import { TableCell } from './table_row/table_cell'; import { formatRow, formatTopLevelObject } from '../lib/row_formatter'; import { useNavigationProps } from '../../../utils/use_navigation_props'; diff --git a/src/plugins/discover/public/components/doc_table/doc_table_wrapper.tsx b/src/plugins/discover/public/components/doc_table/doc_table_wrapper.tsx index cab38790efc4a..b208331601330 100644 --- a/src/plugins/discover/public/components/doc_table/doc_table_wrapper.tsx +++ b/src/plugins/discover/public/components/doc_table/doc_table_wrapper.tsx @@ -8,7 +8,7 @@ import React, { forwardRef, useCallback, useMemo } from 'react'; import { EuiIcon, EuiSpacer, EuiText } from '@elastic/eui'; -import type { DataView, DataViewField } from 'src/plugins/data/common'; +import type { DataView, DataViewField } from 'src/plugins/data_views/public'; import { FormattedMessage } from '@kbn/i18n-react'; import { TableHeader } from './components/table_header/table_header'; import { SHOW_MULTIFIELDS } from '../../../common'; diff --git a/src/plugins/discover/public/components/doc_table/lib/get_default_sort.test.ts b/src/plugins/discover/public/components/doc_table/lib/get_default_sort.test.ts index 68e7b43eceb9e..ae45607a91b50 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_default_sort.test.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_default_sort.test.ts @@ -8,9 +8,9 @@ import { getDefaultSort } from './get_default_sort'; import { - stubIndexPattern, - stubIndexPatternWithoutTimeField, -} from '../../../../../data/common/stubs'; + stubDataView, + stubDataViewWithoutTimeField, +} from '../../../../../data_views/common/data_view.stub'; describe('getDefaultSort function', function () { test('should be a function', function () { @@ -18,12 +18,12 @@ describe('getDefaultSort function', function () { }); test('should return default sort for an index pattern with timeFieldName', function () { - expect(getDefaultSort(stubIndexPattern, 'desc')).toEqual([['@timestamp', 'desc']]); - expect(getDefaultSort(stubIndexPattern, 'asc')).toEqual([['@timestamp', 'asc']]); + expect(getDefaultSort(stubDataView, 'desc')).toEqual([['@timestamp', 'desc']]); + expect(getDefaultSort(stubDataView, 'asc')).toEqual([['@timestamp', 'asc']]); }); test('should return default sort for an index pattern without timeFieldName', function () { - expect(getDefaultSort(stubIndexPatternWithoutTimeField, 'desc')).toEqual([]); - expect(getDefaultSort(stubIndexPatternWithoutTimeField, 'asc')).toEqual([]); + expect(getDefaultSort(stubDataViewWithoutTimeField, 'desc')).toEqual([]); + expect(getDefaultSort(stubDataViewWithoutTimeField, 'asc')).toEqual([]); }); }); diff --git a/src/plugins/discover/public/components/doc_table/lib/get_default_sort.ts b/src/plugins/discover/public/components/doc_table/lib/get_default_sort.ts index 5bd9f293357d3..a100aeeff3493 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_default_sort.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_default_sort.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { isSortable } from './get_sort'; import { SortOrder } from '../components/table_header/helpers'; diff --git a/src/plugins/discover/public/components/doc_table/lib/get_sort.test.ts b/src/plugins/discover/public/components/doc_table/lib/get_sort.test.ts index 7deb8075ac286..dce52adb82519 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_sort.test.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_sort.test.ts @@ -8,9 +8,9 @@ import { getSort, getSortArray } from './get_sort'; import { - stubIndexPattern, - stubIndexPatternWithoutTimeField, -} from '../../../../../data/common/stubs'; + stubDataView, + stubDataViewWithoutTimeField, +} from '../../../../../data_views/common/data_view.stub'; describe('docTable', function () { describe('getSort function', function () { @@ -19,32 +19,32 @@ describe('docTable', function () { }); test('should return an array of objects', function () { - expect(getSort([['bytes', 'desc']], stubIndexPattern)).toEqual([{ bytes: 'desc' }]); - expect(getSort([['bytes', 'desc']], stubIndexPatternWithoutTimeField)).toEqual([ + expect(getSort([['bytes', 'desc']], stubDataView)).toEqual([{ bytes: 'desc' }]); + expect(getSort([['bytes', 'desc']], stubDataViewWithoutTimeField)).toEqual([ { bytes: 'desc' }, ]); }); test('should passthrough arrays of objects', () => { - expect(getSort([{ bytes: 'desc' }], stubIndexPattern)).toEqual([{ bytes: 'desc' }]); + expect(getSort([{ bytes: 'desc' }], stubDataView)).toEqual([{ bytes: 'desc' }]); }); test('should return an empty array when passed an unsortable field', function () { - expect(getSort([['non-sortable', 'asc']], stubIndexPattern)).toEqual([]); - expect(getSort([['lol_nope', 'asc']], stubIndexPattern)).toEqual([]); + expect(getSort([['non-sortable', 'asc']], stubDataView)).toEqual([]); + expect(getSort([['lol_nope', 'asc']], stubDataView)).toEqual([]); - expect(getSort([['non-sortable', 'asc']], stubIndexPatternWithoutTimeField)).toEqual([]); + expect(getSort([['non-sortable', 'asc']], stubDataViewWithoutTimeField)).toEqual([]); }); test('should return an empty array ', function () { - expect(getSort([], stubIndexPattern)).toEqual([]); - expect(getSort([['foo', 'bar']], stubIndexPattern)).toEqual([]); - expect(getSort([{ foo: 'bar' }], stubIndexPattern)).toEqual([]); + expect(getSort([], stubDataView)).toEqual([]); + expect(getSort([['foo', 'bar']], stubDataView)).toEqual([]); + expect(getSort([{ foo: 'bar' }], stubDataView)).toEqual([]); }); test('should convert a legacy sort to an array of objects', function () { - expect(getSort(['foo', 'desc'], stubIndexPattern)).toEqual([{ foo: 'desc' }]); - expect(getSort(['foo', 'asc'], stubIndexPattern)).toEqual([{ foo: 'asc' }]); + expect(getSort(['foo', 'desc'], stubDataView)).toEqual([{ foo: 'desc' }]); + expect(getSort(['foo', 'asc'], stubDataView)).toEqual([{ foo: 'asc' }]); }); }); @@ -54,26 +54,24 @@ describe('docTable', function () { }); test('should return an array of arrays for sortable fields', function () { - expect(getSortArray([['bytes', 'desc']], stubIndexPattern)).toEqual([['bytes', 'desc']]); + expect(getSortArray([['bytes', 'desc']], stubDataView)).toEqual([['bytes', 'desc']]); }); test('should return an array of arrays from an array of elasticsearch sort objects', function () { - expect(getSortArray([{ bytes: 'desc' }], stubIndexPattern)).toEqual([['bytes', 'desc']]); + expect(getSortArray([{ bytes: 'desc' }], stubDataView)).toEqual([['bytes', 'desc']]); }); test('should sort by an empty array when an unsortable field is given', function () { - expect(getSortArray([{ 'non-sortable': 'asc' }], stubIndexPattern)).toEqual([]); - expect(getSortArray([{ lol_nope: 'asc' }], stubIndexPattern)).toEqual([]); + expect(getSortArray([{ 'non-sortable': 'asc' }], stubDataView)).toEqual([]); + expect(getSortArray([{ lol_nope: 'asc' }], stubDataView)).toEqual([]); - expect(getSortArray([{ 'non-sortable': 'asc' }], stubIndexPatternWithoutTimeField)).toEqual( - [] - ); + expect(getSortArray([{ 'non-sortable': 'asc' }], stubDataViewWithoutTimeField)).toEqual([]); }); test('should return an empty array when passed an empty sort array', () => { - expect(getSortArray([], stubIndexPattern)).toEqual([]); + expect(getSortArray([], stubDataView)).toEqual([]); - expect(getSortArray([], stubIndexPatternWithoutTimeField)).toEqual([]); + expect(getSortArray([], stubDataViewWithoutTimeField)).toEqual([]); }); }); }); diff --git a/src/plugins/discover/public/components/doc_table/lib/get_sort.ts b/src/plugins/discover/public/components/doc_table/lib/get_sort.ts index 8cb44c36d9391..5738bb8dc329e 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_sort.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_sort.ts @@ -7,7 +7,7 @@ */ import { isPlainObject } from 'lodash'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; export type SortPairObj = Record; export type SortPairArr = [string, string]; diff --git a/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.test.ts b/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.test.ts index de032c3748fcb..2d3c00ae3ad10 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.test.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.test.ts @@ -8,10 +8,7 @@ import { getSortForSearchSource } from './get_sort_for_search_source'; import { SortOrder } from '../components/table_header/helpers'; -import { - stubIndexPattern, - stubIndexPatternWithoutTimeField, -} from '../../../../../data/common/stubs'; +import { stubDataView, stubDataViewWithoutTimeField } from '../../../../../data/common/stubs'; describe('getSortForSearchSource function', function () { test('should be a function', function () { @@ -20,26 +17,24 @@ describe('getSortForSearchSource function', function () { test('should return an object to use for searchSource when columns are given', function () { const cols = [['bytes', 'desc']] as SortOrder[]; - expect(getSortForSearchSource(cols, stubIndexPattern)).toEqual([{ bytes: 'desc' }]); - expect(getSortForSearchSource(cols, stubIndexPattern, 'asc')).toEqual([{ bytes: 'desc' }]); + expect(getSortForSearchSource(cols, stubDataView)).toEqual([{ bytes: 'desc' }]); + expect(getSortForSearchSource(cols, stubDataView, 'asc')).toEqual([{ bytes: 'desc' }]); - expect(getSortForSearchSource(cols, stubIndexPatternWithoutTimeField)).toEqual([ - { bytes: 'desc' }, - ]); - expect(getSortForSearchSource(cols, stubIndexPatternWithoutTimeField, 'asc')).toEqual([ + expect(getSortForSearchSource(cols, stubDataViewWithoutTimeField)).toEqual([{ bytes: 'desc' }]); + expect(getSortForSearchSource(cols, stubDataViewWithoutTimeField, 'asc')).toEqual([ { bytes: 'desc' }, ]); }); test('should return an object to use for searchSource when no columns are given', function () { const cols = [] as SortOrder[]; - expect(getSortForSearchSource(cols, stubIndexPattern)).toEqual([{ _doc: 'desc' }]); - expect(getSortForSearchSource(cols, stubIndexPattern, 'asc')).toEqual([{ _doc: 'asc' }]); + expect(getSortForSearchSource(cols, stubDataView)).toEqual([{ _doc: 'desc' }]); + expect(getSortForSearchSource(cols, stubDataView, 'asc')).toEqual([{ _doc: 'asc' }]); - expect(getSortForSearchSource(cols, stubIndexPatternWithoutTimeField)).toEqual([ + expect(getSortForSearchSource(cols, stubDataViewWithoutTimeField)).toEqual([ { _score: 'desc' }, ]); - expect(getSortForSearchSource(cols, stubIndexPatternWithoutTimeField, 'asc')).toEqual([ + expect(getSortForSearchSource(cols, stubDataViewWithoutTimeField, 'asc')).toEqual([ { _score: 'asc' }, ]); }); diff --git a/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.ts b/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.ts index fb73df393a0a7..d2314c41c5044 100644 --- a/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.ts +++ b/src/plugins/discover/public/components/doc_table/lib/get_sort_for_search_source.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import type { EsQuerySortValue, DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; +import type { EsQuerySortValue } from 'src/plugins/data/public'; import { SortOrder } from '../components/table_header/helpers'; import { getSort } from './get_sort'; diff --git a/src/plugins/discover/public/components/doc_table/lib/row_formatter.test.ts b/src/plugins/discover/public/components/doc_table/lib/row_formatter.test.ts index 683713af12c8c..ca6cfd5cb8d10 100644 --- a/src/plugins/discover/public/components/doc_table/lib/row_formatter.test.ts +++ b/src/plugins/discover/public/components/doc_table/lib/row_formatter.test.ts @@ -8,7 +8,7 @@ import ReactDOM from 'react-dom/server'; import { formatRow, formatTopLevelObject } from './row_formatter'; -import { DataView } from '../../../../../data/common'; +import { DataView } from '../../../../../data_views/public'; import { fieldFormatsMock } from '../../../../../field_formats/common/mocks'; import { DiscoverServices } from '../../../build_services'; import { stubbedSavedObjectIndexPattern } from '../../../../../data/common/stubs'; diff --git a/src/plugins/discover/public/components/doc_table/lib/row_formatter.tsx b/src/plugins/discover/public/components/doc_table/lib/row_formatter.tsx index 5c5fef0954f0d..5c8c9c05f5fe3 100644 --- a/src/plugins/discover/public/components/doc_table/lib/row_formatter.tsx +++ b/src/plugins/discover/public/components/doc_table/lib/row_formatter.tsx @@ -8,7 +8,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import React, { Fragment } from 'react'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { FieldFormatsStart } from '../../../../../field_formats/public'; import { formatHit } from '../../../utils/format_hit'; diff --git a/src/plugins/discover/public/components/field_name/__stories__/field_name.stories.tsx b/src/plugins/discover/public/components/field_name/__stories__/field_name.stories.tsx index 91ef279405b61..0882991a42cd1 100644 --- a/src/plugins/discover/public/components/field_name/__stories__/field_name.stories.tsx +++ b/src/plugins/discover/public/components/field_name/__stories__/field_name.stories.tsx @@ -10,9 +10,9 @@ import { storiesOf } from '@storybook/react'; import React from 'react'; import { EuiFlexGroup } from '@elastic/eui'; import { FieldName } from '../field_name'; -import { IndexPatternField } from '../../../../../data_views/common'; +import { DataViewField } from '../../../../../data_views/public'; -const field = new IndexPatternField({ +const field = new DataViewField({ name: 'bytes', type: 'number', esTypes: ['long'], diff --git a/src/plugins/discover/public/components/field_name/field_name.tsx b/src/plugins/discover/public/components/field_name/field_name.tsx index 3d198a6daa8c2..8d29606f54ae1 100644 --- a/src/plugins/discover/public/components/field_name/field_name.tsx +++ b/src/plugins/discover/public/components/field_name/field_name.tsx @@ -13,7 +13,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { FieldIcon, FieldIconProps } from '@kbn/react-field'; import { getFieldTypeName } from './field_type_name'; -import { getFieldSubtypeMulti, DataViewField } from '../../../../data/common'; +import { getFieldSubtypeMulti } from '../../../../data_views/public'; +import type { DataViewField } from '../../../../data_views/public'; interface Props { fieldName: string; diff --git a/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx b/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx index aa6b736a04ccb..f67adf0976e59 100644 --- a/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx +++ b/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx @@ -25,15 +25,8 @@ import { generateFilters, } from '../../../data/public'; import { DiscoverServices } from '../build_services'; -import { - Filter, - DataView, - DataViewField, - ISearchSource, - Query, - TimeRange, - FilterStateStore, -} from '../../../data/common'; +import { Filter, ISearchSource, Query, TimeRange, FilterStateStore } from '../../../data/public'; +import { DataView, DataViewField } from '../../../data_views/public'; import { SavedSearchEmbeddableComponent } from './saved_search_embeddable_component'; import { UiActionsStart } from '../../../ui_actions/public'; import { diff --git a/src/plugins/discover/public/embeddable/types.ts b/src/plugins/discover/public/embeddable/types.ts index 95235659d27a8..74fc89e498cdf 100644 --- a/src/plugins/discover/public/embeddable/types.ts +++ b/src/plugins/discover/public/embeddable/types.ts @@ -13,7 +13,8 @@ import { IEmbeddable, } from 'src/plugins/embeddable/public'; import type { Filter } from '@kbn/es-query'; -import { DataView, TimeRange, Query } from '../../../data/common'; +import { DataView } from '../../../data_views/public'; +import type { TimeRange, Query } from '../../../data/public'; import { SavedSearch } from '../services/saved_searches'; import { SortOrder } from '../components/doc_table/components/table_header/helpers'; diff --git a/src/plugins/discover/public/embeddable/utils/update_search_source.ts b/src/plugins/discover/public/embeddable/utils/update_search_source.ts index b2a021a47b7ee..dcc619ec18dae 100644 --- a/src/plugins/discover/public/embeddable/utils/update_search_source.ts +++ b/src/plugins/discover/public/embeddable/utils/update_search_source.ts @@ -5,8 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - -import { DataView, ISearchSource } from '../../../../data/common'; +import type { DataView } from '../../../../data_views/public'; +import { ISearchSource } from '../../../../data/public'; import { getSortForSearchSource } from '../../components/doc_table'; import { SortPairArr } from '../../components/doc_table/lib/get_sort'; diff --git a/src/plugins/discover/public/embeddable/view_saved_search_action.test.ts b/src/plugins/discover/public/embeddable/view_saved_search_action.test.ts index 7306e56e09fa8..cf8dc8020b06d 100644 --- a/src/plugins/discover/public/embeddable/view_saved_search_action.test.ts +++ b/src/plugins/discover/public/embeddable/view_saved_search_action.test.ts @@ -13,7 +13,7 @@ import { SavedSearchEmbeddable } from './saved_search_embeddable'; import { createStartContractMock } from '../__mocks__/start_contract'; import { savedSearchMock } from '../__mocks__/saved_search'; import { discoverServiceMock } from '../__mocks__/services'; -import { DataView } from 'src/plugins/data/common'; +import { DataView } from 'src/plugins/data_views/public'; import { createFilterManagerMock } from 'src/plugins/data/public/query/filter_manager/filter_manager.mock'; import { ViewMode } from 'src/plugins/embeddable/public'; diff --git a/src/plugins/discover/public/locator.test.ts b/src/plugins/discover/public/locator.test.ts index 9a0ece2a434b4..5d86211993428 100644 --- a/src/plugins/discover/public/locator.test.ts +++ b/src/plugins/discover/public/locator.test.ts @@ -8,7 +8,7 @@ import { hashedItemStore, getStatesFromKbnUrl } from '../../kibana_utils/public'; import { mockStorage } from '../../kibana_utils/public/storage/hashed_item_store/mock'; -import { FilterStateStore } from '../../data/common'; +import { FilterStateStore } from '../../data/public'; import { DiscoverAppLocatorDefinition } from './locator'; import { SerializableRecord } from '@kbn/utility-types'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx index 986ad37384c92..5b59f26a6c7cd 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DocViewerSource } from './source'; import * as hooks from '../../../../utils/use_es_doc_search'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.tsx index 9f1cbb7069712..9199903d2c084 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.tsx @@ -16,7 +16,7 @@ import { useDiscoverServices } from '../../../../utils/use_discover_services'; import { JSONCodeEditorCommonMemoized } from '../../../../components/json_code_editor/json_code_editor_common'; import { SEARCH_FIELDS_FROM_SOURCE } from '../../../../../common'; import { useEsDocSearch } from '../../../../utils/use_es_doc_search'; -import { DataView } from '../../../../../../data_views/common'; +import { DataView } from '../../../../../../data_views/public'; import { ElasticRequestState } from '../../../../application/doc/types'; interface SourceViewerProps { diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx index 26dbd76a1dc1a..abd65d726f3ee 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DocViewerLegacyTable } from './table'; -import { DataView } from '../../../../../../../data/common'; +import { DataView } from '../../../../../../../data_views/public'; import { DocViewRenderProps } from '../../../doc_views_types'; import { ElasticSearchHit } from '../../../../../types'; import { KibanaContextProvider } from '../../../../../../../kibana_react/public'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.tsx index e78ed2ccadd06..aab4856d6698c 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.tsx @@ -10,7 +10,7 @@ import '../table.scss'; import React, { useCallback, useMemo } from 'react'; import { EuiInMemoryTable } from '@elastic/eui'; import { useDiscoverServices } from '../../../../../utils/use_discover_services'; -import { flattenHit } from '../../../../../../../data/common'; +import { flattenHit } from '../../../../../../../data/public'; import { SHOW_MULTIFIELDS } from '../../../../../../common'; import { DocViewRenderProps, FieldRecordLegacy } from '../../../doc_views_types'; import { ACTIONS_COLUMN, MAIN_COLUMNS } from './table_columns'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table_cell_actions.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table_cell_actions.tsx index be8d8496cde67..cae127713704b 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table_cell_actions.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table_cell_actions.tsx @@ -11,7 +11,7 @@ import { DocViewTableRowBtnFilterRemove } from './table_row_btn_filter_remove'; import { DocViewTableRowBtnFilterExists } from './table_row_btn_filter_exists'; import { DocViewTableRowBtnToggleColumn } from './table_row_btn_toggle_column'; import { DocViewTableRowBtnFilterAdd } from './table_row_btn_filter_add'; -import { DataViewField } from '../../../../../../../data/common'; +import { DataViewField } from '../../../../../../../data_views/public'; import { DocViewFilterFn } from '../../../doc_views_types'; interface TableActionsProps { diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table.tsx index 521d7d6e75eb2..7aa372e36adff 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table.tsx @@ -31,7 +31,7 @@ import { useDiscoverServices } from '../../../../utils/use_discover_services'; import { Storage } from '../../../../../../kibana_utils/public'; import { usePager } from '../../../../utils/use_pager'; import { FieldName } from '../../../../components/field_name/field_name'; -import { flattenHit } from '../../../../../../data/common'; +import { flattenHit } from '../../../../../../data/public'; import { SHOW_MULTIFIELDS } from '../../../../../common'; import { DocViewRenderProps, FieldRecordLegacy } from '../../doc_views_types'; import { getFieldsToShow } from '../../../../utils/get_fields_to_show'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table_cell_actions.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table_cell_actions.tsx index 7ccb40eaee94a..619d46bada4eb 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table_cell_actions.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/table_cell_actions.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useState } from 'react'; import { EuiButtonIcon, EuiContextMenu, EuiPopover } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { DataViewField } from '../../../../../../data/common'; +import type { DataViewField } from '../../../../../../data_views/public'; import { DocViewFilterFn } from '../../doc_views_types'; interface TableActionsProps { diff --git a/src/plugins/discover/public/services/doc_views/doc_views_types.ts b/src/plugins/discover/public/services/doc_views/doc_views_types.ts index 0287884c8b6f6..3e02a27e8af1a 100644 --- a/src/plugins/discover/public/services/doc_views/doc_views_types.ts +++ b/src/plugins/discover/public/services/doc_views/doc_views_types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DataView, DataViewField } from '../../../../data/common'; +import { DataView, DataViewField } from '../../../../data_views/public'; import { ElasticSearchHit } from '../../types'; import { IgnoredReason } from '../../utils/get_ignored_reason'; diff --git a/src/plugins/discover/public/utils/columns.ts b/src/plugins/discover/public/utils/columns.ts index 537e2bd90d43d..11a9076d555ed 100644 --- a/src/plugins/discover/public/utils/columns.ts +++ b/src/plugins/discover/public/utils/columns.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DataView } from '../../../data/common'; +import { DataView } from '../../../data_views/public'; // We store this outside the function as a constant, so we're not creating a new array every time // the function is returning this. A changing array might cause the data grid to think it got diff --git a/src/plugins/discover/public/utils/format_hit.ts b/src/plugins/discover/public/utils/format_hit.ts index 4c94fd294ba3a..ffc61ff6b0dd9 100644 --- a/src/plugins/discover/public/utils/format_hit.ts +++ b/src/plugins/discover/public/utils/format_hit.ts @@ -9,7 +9,8 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { i18n } from '@kbn/i18n'; import { FieldFormatsStart } from '../../../field_formats/public'; -import { DataView, flattenHit } from '../../../data/common'; +import { flattenHit } from '../../../data/public'; +import { DataView } from '../../../data_views/public'; import { formatFieldValue } from './format_value'; const formattedHitCache = new WeakMap(); diff --git a/src/plugins/discover/public/utils/format_value.ts b/src/plugins/discover/public/utils/format_value.ts index 432978f7fb41f..50318b7d62805 100644 --- a/src/plugins/discover/public/utils/format_value.ts +++ b/src/plugins/discover/public/utils/format_value.ts @@ -8,7 +8,8 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { FieldFormatsStart } from '../../../field_formats/public'; -import { DataView, DataViewField, KBN_FIELD_TYPES } from '../../../data/common'; +import { KBN_FIELD_TYPES } from '../../../data/public'; +import { DataView, DataViewField } from '../../../data_views/public'; /** * Formats the value of a specific field using the appropriate field formatter if available diff --git a/src/plugins/discover/public/utils/get_fields_to_show.test.ts b/src/plugins/discover/public/utils/get_fields_to_show.test.ts index 43c8e1b5b039f..42dde146073f9 100644 --- a/src/plugins/discover/public/utils/get_fields_to_show.test.ts +++ b/src/plugins/discover/public/utils/get_fields_to_show.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DataView, DataViewField } from '../../../data/common'; +import { DataView, DataViewField } from '../../../data_views/public'; import { getFieldsToShow } from './get_fields_to_show'; describe('get fields to show', () => { diff --git a/src/plugins/discover/public/utils/get_fields_to_show.ts b/src/plugins/discover/public/utils/get_fields_to_show.ts index 5916531c9ef40..ddabd1a045883 100644 --- a/src/plugins/discover/public/utils/get_fields_to_show.ts +++ b/src/plugins/discover/public/utils/get_fields_to_show.ts @@ -5,7 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { DataView, getFieldSubtypeMulti } from '../../../data/common'; +import { getFieldSubtypeMulti } from '../../../data_views/public'; +import type { DataView } from '../../../data_views/public'; export const getFieldsToShow = ( fields: string[], diff --git a/src/plugins/discover/public/utils/get_ignored_reason.test.ts b/src/plugins/discover/public/utils/get_ignored_reason.test.ts index 82af0079702da..7f431b578845b 100644 --- a/src/plugins/discover/public/utils/get_ignored_reason.test.ts +++ b/src/plugins/discover/public/utils/get_ignored_reason.test.ts @@ -7,7 +7,8 @@ */ import { getIgnoredReason, IgnoredReason } from './get_ignored_reason'; -import { DataViewField, KBN_FIELD_TYPES } from '../../../data/common'; +import type { DataViewField } from '../../../data_views/public'; +import { KBN_FIELD_TYPES } from '../../../data/public'; function field(params: Partial): DataViewField { return { diff --git a/src/plugins/discover/public/utils/get_ignored_reason.ts b/src/plugins/discover/public/utils/get_ignored_reason.ts index 901765b26b918..891b42073755e 100644 --- a/src/plugins/discover/public/utils/get_ignored_reason.ts +++ b/src/plugins/discover/public/utils/get_ignored_reason.ts @@ -7,7 +7,8 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { DataViewField, KBN_FIELD_TYPES } from '../../../data/common'; +import { KBN_FIELD_TYPES } from '../../../data/public'; +import { DataViewField } from '../../../data_views/public'; export enum IgnoredReason { IGNORE_ABOVE = 'ignore_above', diff --git a/src/plugins/discover/public/utils/get_sharing_data.test.ts b/src/plugins/discover/public/utils/get_sharing_data.test.ts index cc37599ef12c0..71fe826360d8f 100644 --- a/src/plugins/discover/public/utils/get_sharing_data.test.ts +++ b/src/plugins/discover/public/utils/get_sharing_data.test.ts @@ -7,7 +7,7 @@ */ import { Capabilities, IUiSettingsClient } from 'kibana/public'; -import type { DataView } from 'src/plugins/data/common'; +import type { DataView } from 'src/plugins/data_views/public'; import type { DiscoverServices } from '../build_services'; import { dataPluginMock } from '../../../data/public/mocks'; import { createSearchSourceMock } from '../../../data/common/search/search_source/mocks'; diff --git a/src/plugins/discover/public/utils/get_sharing_data.ts b/src/plugins/discover/public/utils/get_sharing_data.ts index deb8d0904782d..b1c23e1d7bce7 100644 --- a/src/plugins/discover/public/utils/get_sharing_data.ts +++ b/src/plugins/discover/public/utils/get_sharing_data.ts @@ -8,9 +8,12 @@ import type { Capabilities } from 'kibana/public'; import type { IUiSettingsClient } from 'kibana/public'; -import type { DataPublicPluginStart } from 'src/plugins/data/public'; +import type { + DataPublicPluginStart, + ISearchSource, + SerializedSearchSourceFields, +} from 'src/plugins/data/public'; import type { Filter } from '@kbn/es-query'; -import type { ISearchSource, SerializedSearchSourceFields } from 'src/plugins/data/common'; import { DOC_HIDE_TIME_COLUMN_SETTING, SEARCH_FIELDS_FROM_SOURCE, diff --git a/src/plugins/discover/public/utils/popularize_field.ts b/src/plugins/discover/public/utils/popularize_field.ts index 3ac417993956b..3964cf363f193 100644 --- a/src/plugins/discover/public/utils/popularize_field.ts +++ b/src/plugins/discover/public/utils/popularize_field.ts @@ -8,7 +8,7 @@ import type { Capabilities } from 'kibana/public'; import { DataViewsContract } from '../../../data/public'; -import { DataView } from '../../../data/common'; +import { DataView } from '../../../data_views/public'; async function popularizeField( indexPattern: DataView, diff --git a/src/plugins/discover/public/utils/use_es_doc_search.test.tsx b/src/plugins/discover/public/utils/use_es_doc_search.test.tsx index 629a2b4d10470..26f048893e6b5 100644 --- a/src/plugins/discover/public/utils/use_es_doc_search.test.tsx +++ b/src/plugins/discover/public/utils/use_es_doc_search.test.tsx @@ -9,7 +9,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { buildSearchBody, useEsDocSearch } from './use_es_doc_search'; import { Observable } from 'rxjs'; -import { DataView } from 'src/plugins/data/common'; +import { DataView } from 'src/plugins/data_views/public'; import { DocProps } from '../application/doc/components/doc'; import { ElasticRequestState } from '../application/doc/types'; import { SEARCH_FIELDS_FROM_SOURCE as mockSearchFieldsFromSource } from '../../common'; diff --git a/src/plugins/discover/public/utils/use_es_doc_search.ts b/src/plugins/discover/public/utils/use_es_doc_search.ts index ac94fccdd3e12..e33d30d65979e 100644 --- a/src/plugins/discover/public/utils/use_es_doc_search.ts +++ b/src/plugins/discover/public/utils/use_es_doc_search.ts @@ -8,7 +8,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { DataView } from '../../../data/common'; +import { DataView } from '../../../data_views/public'; import { DocProps } from '../application/doc/components/doc'; import { ElasticRequestState } from '../application/doc/types'; import { SEARCH_FIELDS_FROM_SOURCE } from '../../common'; diff --git a/src/plugins/discover/public/utils/use_index_pattern.tsx b/src/plugins/discover/public/utils/use_index_pattern.tsx index 318a998c79f47..6146aec13a3e4 100644 --- a/src/plugins/discover/public/utils/use_index_pattern.tsx +++ b/src/plugins/discover/public/utils/use_index_pattern.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import { useEffect, useState } from 'react'; -import { DataView, DataViewsContract } from '../../../data/common'; +import { DataView, DataViewsContract } from '../../../data_views/public'; export const useIndexPattern = (indexPatterns: DataViewsContract, indexPatternId: string) => { const [indexPattern, setIndexPattern] = useState(undefined); diff --git a/src/plugins/discover/server/saved_objects/search_migrations.ts b/src/plugins/discover/server/saved_objects/search_migrations.ts index 0c45db5cd779e..5d630f782fb78 100644 --- a/src/plugins/discover/server/saved_objects/search_migrations.ts +++ b/src/plugins/discover/server/saved_objects/search_migrations.ts @@ -11,7 +11,7 @@ import { flow, get } from 'lodash'; import { SavedObjectMigrationFn } from 'kibana/server'; -import { DEFAULT_QUERY_LANGUAGE } from '../../../data/common'; +import { DEFAULT_QUERY_LANGUAGE } from '../../../data/server'; /** * This migration script is related to: