diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx index fca958a39b086f..88e32956cfc616 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx @@ -16,6 +16,7 @@ import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; import { IndexPattern } from './types'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; +import { documentField } from './document_field'; const chartsThemeService = chartPluginMock.createSetupContract().theme; @@ -70,6 +71,7 @@ describe('IndexPattern Field Item', () => { aggregatable: true, searchable: true, }, + documentField, ], } as IndexPattern; @@ -263,4 +265,14 @@ describe('IndexPattern Field Item', () => { } ); }); + + it('should not request field stats for document field', async () => { + const wrapper = mountWithIntl(); + + clickField(wrapper, 'Records'); + + expect(core.http.post).not.toHaveBeenCalled(); + expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true); + expect(wrapper.find(EuiLoadingSpinner)).toHaveLength(0); + }); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx index e0198d6d7903e7..b1784b85d127d3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx @@ -122,7 +122,7 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) { }); function fetchData() { - if (state.isLoading) { + if (state.isLoading || field.type === 'document') { return; }