-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SOM] Fix UI and export when handling more than 10k objects #118335
[SOM] Fix UI and export when handling more than 10k objects #118335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self-review
for (let i = startIdx; i <= endIdx; i++) { | ||
const id = `test-vis-${i}`; | ||
fileChunks.push( | ||
JSON.stringify({ | ||
type: 'visualization', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially created a file with 10k entries with a script and used kibanaServer.importExport
API, but the file is quite big and the API only accepts uncompressed files.
Also, this is how this is done for the export and import test suites too:
kibana/test/api_integration/apis/saved_objects/export.ts
Lines 277 to 281 in 7917e3c
fileChunks.push( | |
JSON.stringify({ | |
type: 'visualization', | |
id: `${SPACE_ID}-${i}`, | |
attributes: { |
await importVisualizations({ startIdx: 1, endIdx: 6000 }); | ||
await importVisualizations({ startIdx: 6001, endIdx: 12000 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the import limit is 10001
, I'm imported the 12k in two batches. This is also an additional check that the scroll_count
API works when there are more objects than the limit in the search results.
describe('scroll_count with more than 10k objects', () => { | ||
const importVisualizations = async ({ | ||
startIdx = 1, | ||
endIdx, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only added FTR tests for this API because export
and import
were already properly working and are covered, e.g
kibana/test/api_integration/apis/saved_objects/export.ts
Lines 525 to 527 in 7917e3c
it('should allow exporting more than 10,000 objects if permitted by maxImportExportSize', async () => { | |
await supertest | |
.post(`/s/${SPACE_ID}/api/saved_objects/_export`) |
@@ -74,6 +74,8 @@ interface TableState { | |||
activeAction?: SavedObjectsManagementAction; | |||
} | |||
|
|||
const MAX_PAGINATED_ITEM = 10000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of this hardcoded limit, OTOH that's how it's done in other parts of Kibana too, and it's way easier than fetching the setting from all the SO indices targeted by the request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can an end-user face the problem when requesting /api/kibana/management/saved_objects/scroll/counts
? If so, maybe this logic belongs to the server-side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can't when requesting /api/kibana/management/saved_objects/scroll/counts
, or when performing the export, only when manually calling /api/kibana/management/saved_objects/_find
if the requested page/perPage exceeds the threshold (but even if prefixed by /api
, there shouldn't be a case where an integration uses this endpoint)
Pinging @elastic/kibana-core (Team:Core) |
@elasticmachine merge upstream |
…from-main-this-time
@@ -74,6 +74,8 @@ interface TableState { | |||
activeAction?: SavedObjectsManagementAction; | |||
} | |||
|
|||
const MAX_PAGINATED_ITEM = 10000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can an end-user face the problem when requesting /api/kibana/management/saved_objects/scroll/counts
? If so, maybe this logic belongs to the server-side?
…from-main-this-time
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…118335) * delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…#118669) * delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Pierre Gayvallet <[email protected]>
…118335) * delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/saved_objects_management/server/routes/scroll_export.ts
…#118718) * delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/saved_objects_management/server/routes/scroll_export.ts
…118335) * delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]>
* delete the unused `scroll/export` endpoint * adapt the scroll/counts endpoint to use PIT search * improve export error message * only display 10k first items * fix findAll unit tests * fix FTR test * remove unused comment Co-authored-by: Kibana Machine <[email protected]>
Summary
Fix #116776
/api/kibana/management/saved_objects/scroll/counts
endpoint to use PIT search/api/kibana/management/saved_objects/scroll/export
endpoint that was unused (was used by the legacy export that was removed long ago)Screenshots
Displaying 12k vis
Toast notification in case of failure
Checklist
Release Note
Fix a bug in the saved objects management section causing the export of more than 10k objects to fail.