-
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
Basic server side export API for saved objects #30326
Conversation
Pinging @elastic/kibana-platform |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: mikecote <[email protected]>
This comment has been minimized.
This comment has been minimized.
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.
LGTM!
This comment has been minimized.
This comment has been minimized.
Why have two separate endpoints rather than a single endpoint with an optional |
@epixa We had them as a single endpoint before but it served two different purposes. It could either export |
@mikecote Can you add more details to the REST API docs changes in this PR that describe how you'd use each endpoint and such? It's just not clear to me what the diverging purpose is, but it sounds like I just don't understand what the endpoints do. |
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
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.
LGTM from the security perspective. Thanks for creating all these tests @mikecote!
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.
LGTM
💚 Build Succeeded |
* Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <[email protected]> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <[email protected]> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <[email protected]> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <[email protected]> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <[email protected]> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
* Initial work for new server side export API * Revert UI changes, API only in this PR * Remove whitespace at top of export.asciidoc * Add tests around limitations * Add comment * Convert some files to typescript * Move Boom.boomify to where the errors are created * Use Boom.badRequest for now * Fix lint issue * Move files * Update tests * Add functional test * Export all documents by default * Update test assertions * Use ~10000 saved objects in export api integration test * Convert route to typescript, add content-type response header * Move some tests to api_integration * Use new sort and rename functions/variables * Move tests to API integration * Cleanup and finalize api integration tests * Make type or objects required but not both in the same call * Add spaces / security tests * Add noTypeOrObjects to security / spaces tests * Use json-stable-stringify and add tests for export ordering * Address self feedback, add without kibana index test * Only allow export API to export index-pattern, dashboard, visualization and search type objects * Make import export size configurable and fix broken tests * Fix broken tests * Move test config to mock server * Add more typescript types instead of using any * Convert request from GET to POST * Fix saved objects mixin test * Update src/legacy/server/saved_objects/lib/export.ts Co-Authored-By: mikecote <[email protected]> * Apply PR feedback * Fix lint error * Update test snapshots due to jest upgrade * Add error handling for bulkGet * Split export API into two endpoints * Update src/legacy/server/saved_objects/routes/export_by_type.test.ts Co-Authored-By: mikecote <[email protected]> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <[email protected]> * Update docs/api/saved-objects/export_by_type.asciidoc Co-Authored-By: mikecote <[email protected]> * Update src/legacy/server/saved_objects/routes/export_objects.test.ts Co-Authored-By: mikecote <[email protected]> * Apply PR feedback * MockServer -> createMockServer * Revert back to single API * Re-apply PR feedback
@rayafratkina good catch, that is a very cool feature! I will go through my PRs and fix accordingly. |
💔 Build Failed |
PR implements the first steps of the saved object export API for #4759.
An endpoint id added under
POST /api/saved_objects/_export
that throws an error after 10,000 objects. The removal of the limit will come in a future PR when using streams to optimize scalability and performance. This basic PR will allow focus on the import aspect sooner as that will be more complex to solve.Also a future PR will change the management UI to use the new API once import and export APIs are complete on the server side.
Dev-Docs
Added server side API for exporting saved objects
A new endpoint
/api/saved_objects/_export
now exists to export saved objects.