diff --git a/src/plugins/discover/public/application/doc/components/doc.tsx b/src/plugins/discover/public/application/doc/components/doc.tsx
index 1b3d8f494d42b..83c2c08eafa2e 100644
--- a/src/plugins/discover/public/application/doc/components/doc.tsx
+++ b/src/plugins/discover/public/application/doc/components/doc.tsx
@@ -9,39 +9,18 @@
import React, { useEffect } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiCallOut, EuiLink, EuiLoadingSpinner, EuiPage, EuiPageBody } from '@elastic/eui';
-import type { DataView } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
-import type { DataTableRecord } from '@kbn/discover-utils/types';
import { ElasticRequestState } from '@kbn/unified-doc-viewer';
import { UnifiedDocViewer, useEsDocSearch } from '@kbn/unified-doc-viewer-plugin/public';
+import type { EsDocSearchProps } from '@kbn/unified-doc-viewer-plugin/public/types';
import { setBreadcrumbs } from '../../../utils/breadcrumbs';
import { useDiscoverServices } from '../../../hooks/use_discover_services';
-export interface DocProps {
- /**
- * Id of the doc in ES
- */
- id: string;
- /**
- * Index in ES to query
- */
- index: string;
- /**
- * DataView entity
- */
- dataView: DataView;
- /**
- * If set, will always request source, regardless of the global `fieldsFromSource` setting
- */
- requestSource?: boolean;
+export interface DocProps extends EsDocSearchProps {
/**
* Discover main view url
*/
referrer?: string;
- /**
- * Records fetched from text based query
- */
- textBasedHits?: DataTableRecord[];
}
export function Doc(props: DocProps) {
diff --git a/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.test.tsx b/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.test.tsx
index d3852e42458d6..cee1cf509e138 100644
--- a/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.test.tsx
+++ b/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.test.tsx
@@ -7,7 +7,7 @@
*/
import { renderHook, act } from '@testing-library/react-hooks';
-import { type DocProps, buildSearchBody, useEsDocSearch } from './use_es_doc_search';
+import { type EsDocSearchProps, buildSearchBody, useEsDocSearch } from './use_es_doc_search';
import { Subject } from 'rxjs';
import type { DataView } from '@kbn/data-views-plugin/public';
import { ElasticRequestState } from '@kbn/unified-doc-viewer';
@@ -226,9 +226,9 @@ describe('Test of helper / hook', () => {
id: '1',
index: 'index1',
dataView,
- } as unknown as DocProps;
+ } as unknown as EsDocSearchProps;
- const hook = renderHook((p: DocProps) => useEsDocSearch(p), {
+ const hook = renderHook((p: EsDocSearchProps) => useEsDocSearch(p), {
initialProps: props,
wrapper: ({ children }) => (
{children}
@@ -250,9 +250,9 @@ describe('Test of helper / hook', () => {
id: '1',
index: 'index1',
dataView,
- } as unknown as DocProps;
+ } as unknown as EsDocSearchProps;
- const hook = renderHook((p: DocProps) => useEsDocSearch(p), {
+ const hook = renderHook((p: EsDocSearchProps) => useEsDocSearch(p), {
initialProps: props,
wrapper: ({ children }) => (
{children}
@@ -304,9 +304,9 @@ describe('Test of helper / hook', () => {
flattened: { field1: 1, field2: 2 },
},
],
- } as unknown as DocProps;
+ } as unknown as EsDocSearchProps;
- const hook = renderHook((p: DocProps) => useEsDocSearch(p), {
+ const hook = renderHook((p: EsDocSearchProps) => useEsDocSearch(p), {
initialProps: props,
wrapper: ({ children }) => (
{children}
diff --git a/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.ts b/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.ts
index 5b04b8bb60a97..d215306d6f7ea 100644
--- a/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.ts
+++ b/src/plugins/unified_doc_viewer/public/hooks/use_es_doc_search.ts
@@ -18,7 +18,7 @@ import { useUnifiedDocViewerServices } from './use_doc_viewer_services';
type RequestBody = Pick;
-export interface DocProps {
+export interface EsDocSearchProps {
/**
* Id of the doc in ES
*/
@@ -35,10 +35,6 @@ export interface DocProps {
* If set, will always request source, regardless of the global `fieldsFromSource` setting
*/
requestSource?: boolean;
- /**
- * Discover main view url
- */
- referrer?: string;
/**
* Records fetched from text based query
*/
@@ -54,7 +50,7 @@ export function useEsDocSearch({
dataView,
requestSource,
textBasedHits,
-}: DocProps): [ElasticRequestState, DataTableRecord | null, () => void] {
+}: EsDocSearchProps): [ElasticRequestState, DataTableRecord | null, () => void] {
const [status, setStatus] = useState(ElasticRequestState.Loading);
const [hit, setHit] = useState(null);
const { data, uiSettings, analytics } = useUnifiedDocViewerServices();
diff --git a/src/plugins/unified_doc_viewer/public/types.ts b/src/plugins/unified_doc_viewer/public/types.ts
index e8546fbc9a97f..d9ec40eedfffb 100644
--- a/src/plugins/unified_doc_viewer/public/types.ts
+++ b/src/plugins/unified_doc_viewer/public/types.ts
@@ -7,5 +7,5 @@
*/
export type { JsonCodeEditorProps } from './components';
-export type { UnifiedDocViewerServices } from './hooks';
+export type { EsDocSearchProps, UnifiedDocViewerServices } from './hooks';
export type { UnifiedDocViewerSetup, UnifiedDocViewerStart } from './plugin';