diff --git a/packages/kbn-unified-data-table/src/components/data_table.tsx b/packages/kbn-unified-data-table/src/components/data_table.tsx index 22d080767533f..1a12151c7c18a 100644 --- a/packages/kbn-unified-data-table/src/components/data_table.tsx +++ b/packages/kbn-unified-data-table/src/components/data_table.tsx @@ -575,14 +575,15 @@ export const UnifiedDataTable = ({ valueToStringConverter, componentsTourSteps, isPlainRecord, - pageIndex: paginationObj?.pageIndex, - pageSize: paginationObj?.pageSize, + pageIndex: isPaginationEnabled ? paginationObj?.pageIndex : 0, + pageSize: isPaginationEnabled ? paginationObj?.pageSize : displayedRows.length, }), [ componentsTourSteps, darkMode, dataView, isPlainRecord, + isPaginationEnabled, displayedRows, expandedDoc, onFilter, 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 9e061beffc4fc..e6fb6472397f3 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 @@ -417,6 +417,7 @@ function DiscoverDocumentsComponent({ onUpdateRowHeight={onUpdateRowHeight} isSortEnabled={true} isPlainRecord={isEsqlMode} + isPaginationEnabled={!isEsqlMode} rowsPerPageState={rowsPerPage ?? getDefaultRowsPerPage(services.uiSettings)} onUpdateRowsPerPage={onUpdateRowsPerPage} maxAllowedSampleSize={getMaxAllowedSampleSize(services.uiSettings)} diff --git a/src/plugins/discover/public/embeddable/components/saved_search_grid.tsx b/src/plugins/discover/public/embeddable/components/saved_search_grid.tsx index 8f8a94fdb7bda..2c67595b846b6 100644 --- a/src/plugins/discover/public/embeddable/components/saved_search_grid.tsx +++ b/src/plugins/discover/public/embeddable/components/saved_search_grid.tsx @@ -104,6 +104,7 @@ export function DiscoverGridEmbeddable(props: DiscoverGridEmbeddableProps) { > { @@ -119,5 +127,45 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect((await dataGrid.getDocTableRows()).length).to.be(10); // as in the saved search await dataGrid.checkCurrentRowsPerPageToBe(10); }); + + it('should not split ES|QL results into pages', async () => { + const rowsPerPage = 5; + const savedSearchESQL = 'testESQLPagination'; + await kibanaServer.uiSettings.update({ + ...defaultSettings, + 'discover:sampleRowsPerPage': rowsPerPage, + hideAnnouncements: true, + }); + + await PageObjects.common.navigateToApp('discover'); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + // expect pagination to be present for data view mode + expect((await dataGrid.getDocTableRows()).length).to.be(rowsPerPage); + await dataGrid.checkCurrentRowsPerPageToBe(rowsPerPage); + await testSubjects.existOrFail('pagination-button-0'); + + await PageObjects.discover.selectTextBaseLang(); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + // expect no pagination for ES|QL mode + expect((await dataGrid.getDocTableRows()).length).to.above(rowsPerPage); + await testSubjects.missingOrFail('pagination-button-0'); + + await PageObjects.discover.saveSearch(savedSearchESQL); + + await PageObjects.common.navigateToApp('dashboard'); + + await PageObjects.dashboard.clickNewDashboard(); + await PageObjects.timePicker.setDefaultAbsoluteRange(); + await dashboardAddPanel.clickOpenAddPanel(); + await dashboardAddPanel.addSavedSearch(savedSearchESQL); + await PageObjects.header.waitUntilLoadingHasFinished(); + + // expect no pagination for ES|QL mode on Dashboard + expect((await dataGrid.getDocTableRows()).length).to.above(rowsPerPage); + await testSubjects.missingOrFail('pagination-button-0'); + }); }); }